gorhill / PHP-FineDiff

A PHP implementation of a Fine granularity Diff engine: Diff can be computed up to character-level

Home Page:http://www.raymondhill.net/finediff/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

finediff destroys german Umlaute in html-result

aaronnottbeck opened this issue · comments

I like your diff tool very much and most times it works fine for me.
If i try to diff a text with german Umlaute the result is not that nice.
Your tool recognize the changes but the result shows the Umlaute as html decoded.
Ü is shown as Ü and so on.

FineDiff wasn't meant for display purpose. But I had started work to fix the general "display diff with Unicode characters" problem with FineDiff, but didn't find time to work more on this. Dup of #20.

this has nothing to do with unicode. imo you're using htmlentities in a wrong way. i fixed it for me.

Can you share? I had assumed it was the recurring Unicode issue with FineDiff, as it knows only about binary strings, not Unicode characters.

i am not sure if my change is generally correct - i just removed htmlentities function in the html renderer:
https://github.com/aaronnottbeck/PHP-FineDiff
for me it works.

Ok I see. I had changes related to #20, which are not checked-in. You are right that htmlentities is not the right thing to use, but not escaping at all is not the right thing either. My local changes replaced htmlentities with htmlspecialchars. These changes have been live on my server for a while now (though not reflected in the github repo), so if you still have problem with the online tool, it's again the recurring issue that FineDiff is unaware of Unicode characters.

as i wrote. i fixed it for me - thanks for answering.

You are going to have problem if there are special chars in the output, such as <, >, etc. This can easily lead to security issue if the output is used as is on a server.