-
Notifications
You must be signed in to change notification settings - Fork 181
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
Special Characters #89
Comments
@adonisfigueroa I am not able to repeat the error. What version of the library are you using? What is the version of PHP?
gives |
Can you post your |
There was a similar problem sometime ago #48 which was fixed. Are you running with the latest versions of the library and its dependencies? |
I made un update today (with composer), I have this version: About the phpinfo, what information do you need specifically? |
@adonisfigueroa |
What is the output of the small program I posted in #89 (comment) for you? |
Output: Gael GarcÃa Bernal |
This is puzzling for me. What is your operating system? Can you try on another installation of PHP (preferably on LInux or Mac) that you might have access to and tell me what results you are getting? |
My localhost is Ubuntu 14.04.4 LTS with php 5.5.9 |
|
php -i | grep libxml When execute the code in console, I get correct characters, maybe some problems with charset ISO-8859-1? /usr/bin/php /var/www/html/test.php Gael García Bernal |
Ah! So things are working correctly in the console and not working correctly in the browser? The AMP library output is UTF-8. We only support UTF-8 output. |
(We don't support ISO-8859-1) |
But you can try to do some encoding conversions using mb_convert_encoding. Encoding conversions are tricky but ISO-8859-1 is quite a mainstream encoding... However, I would advise using UTF-8 for all multilingual stuff in your web pages... |
Before submit the issue, I made a test with mb_convert_encoding, but that symbols were unsuccessful, I'll try converting in other way before call to loadHtml. |
Is there a reason why you must use ISO-8859-1 for your output? UTF-8 is just so much better and you can mix languages other than those supported in latin-1... |
Yes, we need to use the AMP in a site with many content in the database that is in ISO-8859-1, then to support UTF-8, we need to convert first all the data. |
I'm closing this ticket as this not really a bug in the library. The library is working as intended. However feel free to keep updating this ticket in case you find something useful or need any help... |
Ok thanks for your help |
I want to re-word a comment I made above:
Actually, it would be more accurate to say is you should only provide UTF-8 input to the library and then you would get proper UTF-8 output. We only support UTF-8 encoding. |
It works if the content to UTF-8 is parsed before the call loadHTML and then the results are parsing to initial encoded: $text = iconv('ISO-8859-1', 'UTF-8//TRANSLIT//IGNORE', $text); Thanks again. You could mention about the encoding supported in the documentation. |
@adonisfigueroa Thanks for the tip. I have updated BTW I'm curious that you chose to use |
It was an example, but the good news it's that both work (using it before and after AMP library). |
Sorry, an example where it doesn't work with mb_convert_encoding but it works with iconv: |
Some text with special characters has a wrong parse, for example:
$amp = new AMP();
$amp->loadHtml("You’re there");
echo $amp->convertToAmpHtml();
Or symbols:
$amp->loadHtml("end");
Other examples:
première
of ‘A
a – b
Gael García Bernal
-“quotes”-
The text was updated successfully, but these errors were encountered: