forceutf8 icon indicating copy to clipboard operation
forceutf8 copied to clipboard

Error in conversion

Open dugwood opened this issue 8 months ago • 0 comments

Thanks for the port to composer.

You've forked from a repository that introduced an issue after forking from the original repository. So you've got the bug too :-)

I'm trying to fix MAÃÂL, which is converted to MAÃ?Â?L with your library, but not with the original repository that translates it to MAËL (the expected result).

Seems to be the choice for Windows-1252 instead of ISO-8859-15 here: https://github.com/Fylax/forceutf8/blob/master/ForceUTF8/Encoding.php#L329

utf8_decode() « Converts a string from UTF-8 to ISO-8859-1 »

And the source only uses utf8_decode, so it should be ISO-8859-15 instead of Windows-1252: https://github.com/neitanod/forceutf8/blob/master/src/ForceUTF8/Encoding.php#L343

But perhaps it creates collateral damages, so I don't know if it should be fixed... As using iconv is using Windows-1252: https://github.com/neitanod/forceutf8/blob/master/src/ForceUTF8/Encoding.php#L347

Perhaps my original string is wrong (but it exists in my database) :smile:

dugwood avatar Jun 18 '24 14:06 dugwood