I have a file UTF-8 encoding in windows, and when i use it under windows it shows everithing right, but when i copy the file in Linux, the Unicode characters are giberish. The file is plain textfile. How can i get this file to be readable in linux, or how can i copy it properly??
thanks in advance
Looks like an Apache/PHP issue
Are you running your strings through PHP's built-in htmlspecialchars method (or similar)? If so, you may need to switch its encoding to UTF8
Instead of htmlspecialchars($mytext)
, try using htmlspecialchars($mytext, ENT_COMPAT, 'UTF-8')
Note the following (my previous answer) is incorrect, as Michael Burr notes, UTF-8 doesn't need or use the BOM.
If it's just the text, then there's a chance it's missing the Byte Order Mark (BOM), or is encoded with an incorrect BOM.
If it's incorrect, the linux reader may be honouring it but your windows reader is ignoring it. Try re-opening your file in something like Notepad++ and resaving. Notepad++ has a bunch of options in the Format menu about saving UTF-8 files.