Skip to content
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 issues with umlauts #71

Closed
iluuu1994 opened this issue Feb 7, 2018 · 0 comments
Closed

Encoding issues with umlauts #71

iluuu1994 opened this issue Feb 7, 2018 · 0 comments

Comments

@iluuu1994
Copy link
Contributor

I'm not sure if this repo is still maintained but I'd really appreciate some help. I'm having some encoding issues with umlauts and I cannot for the life of me figure out how to fix this. This is the code I'm running:

$oldValue = 'Änderung';
$newValue = 'Test Änderung';

var_dump($oldValue);
var_dump(mb_detect_encoding($oldValue));
var_dump($newValue);
var_dump(mb_detect_encoding($newValue));

$htmlDiff = new HtmlDiff($oldValue, $newValue);
$result = $htmlDiff->build();

var_dump($result);
var_dump(mb_detect_encoding($result));

//> string(9) "Änderung"
//> string(5) "UTF-8"
//> string(14) "Test Änderung"
//> string(5) "UTF-8"
//> string(74) "test� Test � nderung"
//> string(5) "UTF-8"

For some reason HtmlDiff breaks the encoding. What confuses me is that the example works perfectly on the http://php-htmldiff.caxy.com/ website. Is this not supported or am I doing something wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant