-
Notifications
You must be signed in to change notification settings - Fork 179
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
Encoding problems on Ubuntu 12.04 LTS (libxml 2.7.8) #48
Comments
Hmm...I wonder what the problem is here. Ideally you shouldn't need to convert to HTML-ENTITIES in the above fashion. What is your original HTML (before any AMP formatter has run)? As you point out on https://www.drupal.org/node/2712895#comment-11134411 , the problem occurs on Acquia Cloud only and works fine on your localhost (without any code modifications required). |
Don't worry about the API version being 20031129. Even in PHP 7, it list the API version as 20031129. The main question is:
You would need to do go to the following links in your browser:
Have you tried switching the version of PHP on your Acquia Cloud to a higher version and seeing if it fixes things? (you would need access the Acquia Cloud control panel to do this) |
We just tested locally against a very old installation (PHP 5.4.45) with libxml 2.7.6. We are facing exact the same encoding problems as on Acquia Cloud. |
What happens when you remove the line
|
Removing the line mentioned above doesn't change the behaviour. Umlauts are the same way broken: _ Dies liess der heute 64-Jährige nicht auf sich sitzen_ |
In this snippet above there is no AMP stuff happening at all but you're able to get broken umlauts. Presumably this is because of the old libxml. Why is Acquia using an old libxml when I see that ubuntu 14.04 (trusty) is also using 2.9.1 ? (Is this a plain vanilla installation on your localhost) ? What about raising a ticket with Acquia and asking when whats up with their libxml ? (My localhost has 2.9.0 for what its worth). Incidentally libxml version 2.7.8 dates back to Nov 2010 which is a long time on the internet ! ( See http://xmlsoft.org/news.html ). 2.7.0 was released way back in 2008 |
I can rewrite my snipped to use the AMP the way the Drupal module does. The result would be the same. My indention was to reduce the problem to the absolute minimum. This is what AMP does at the end. Ubuntu 14.04 comes with libxml 2.9.1 but 12.04 (LTS) is still on 2.7.8. My local machine is Ubuntu 14.04 and our Acquia environment is still 12.04. I have tried a different Ubuntu 12.04 server, that is not in the acquia cloud and got the same errors. That means - there is a problem with libxml 2.7.8 on Ubuntu 12.04 and AMP seems not to run on that hosts. |
Here is the snippet using the AMP PHP library:
On Ubuntu 12.04 with libxml 2.7.8 that results in:
|
With libxml 2.9.0 I get
(which is correct) |
I'll leave this ticket open for now -- encoding issues are very hairy. There is a known workaround as mentioned by you. It would great if you filed a bug report with Acquia and ask them why they are using such an old libxml. |
I already filed a bug report at Acquia. The reason why they use libxml 2.8.7 is that it is bundled to Ubuntu 12.04 upgrading to Ubuntu 14.04 now is not an option.
And
I personally like the idea of having ubuntu 12.04 in this library. But maybe i am the only one using AMP on Drupal and Ubuntu 12.04 |
Thanks for taking the time in reporting this problem to us and Acquia. As mentioned I'll leave this ticket open for now -- I'll do some more research on whether there might be a more optimal way to solve this issue other than the workaround you mentioned. |
@dsayswhat @Scuts TL;DR The latest release of the library will work with libxml 2.7.8 without any workarounds. Please test on your setup and confirm! To test this, I installed a fresh Ubuntu 12.04 virtual machine instance. I had to compile PHP 5.5, 5.6 & 7.0 from source (with libxml 2.7.8) as 12.04 is bundled with PHP 5.3 (we only support PHP 5.5+) $ cat test.php
<?php
require_once 'vendor/autoload.php';
$amp = new \Lullabot\AMP\AMP();
$amp->loadHtml('<p>äüö</p>');
var_dump($amp->convertToAmpHtml());
$ php -i | grep "libxml Version"
libxml Version => 2.7.8
$ php test.php
string(13) "<p>äüö</p>" This is working now because we're using the |
I am using the amp module for Drupal 7 and i'm facing an encoding issue when using that in my hosting environment. I did a lot of research and debugging and i narrowed down the problem to the native DomDocument - implementation.
I already created an issue on d.o for that: https://www.drupal.org/node/2712895
AMP::convertToAmpHtml()
calls$qp = QueryPath::withHTML($document, NULL, ['convert_to_encoding' => 'UTF-8']);
that results (simplified) to an equivalent of this:This is where my umlauts get broken in my hosting environment. When i change the lines to
Everything works fine.
I think that might be an issue with PHP/libxml? Is that library too old to work with AMP?
The text was updated successfully, but these errors were encountered: