-
-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"invalid multibyte sequence" reading generated PO file #131
Comments
I never had this problem with SublimeText, so maybe it's due to multiple encoded files in your projects (I don't know). SublimeText allows to reopen the file using a specific encoding, so reopening with utf-8 should'n report this error. |
@oscarotero I really don't care much about SublimeText, was just a comment. $filecontent = file_get_contents($file);
$encoding = mb_detect_encoding($filecontent, 'ISO-8859-1, UTF-8', true);
if($encoding && $encoding != 'UTF-8') {
$filecontent = mb_convert_encoding($filecontent, 'UTF-8', $encoding);
$encoding = 'UTF-8';
}
if($encoding == 'UTF-8') {
$translations->addFromPhpCodeString($filecontent);
} But this makes it slower. |
@delmicio This is a problem with your source files and the way you create the catalog.
So you must either fix your source files or set the the correct header before creating the
|
In theory, this header is added by default. https://github.com/oscarotero/Gettext/blob/master/src/Translations.php#L109 |
When I try to open the generated PO file is corrupted and can't open it with for ex.: poedit.
"invalid multibyte sequence"
I think is a problem with the encoding.
This code I use to generate the file:
I must say that not of all my project files are UTF-8 encoded ¿may be this is the problem?
USING v3
The text was updated successfully, but these errors were encountered: