Forum > Translations

cross platform text with European accents .

(1/2) > >>

lazer:
Hi,

I have a program displaying the content of some text files with accented characters. I'm having trouble getting it to display consistently between Windows and Linux.

I seem to need utf8 on Linux and ISO-8859-15 on Windows.

I don't want to have to have two versions of the text files. Is there common encoding  I can use of both platforms?

TIA.


Lulu:
If I am not mistaken, UTF8 is the 'standard' in Lazarus LCL for all platforms. Its curious that you have to encode your files with ISO-xxxx on Windows. Can you provide some code to show the way you read this file and displaying it ?

lazer:
Yes, you are correct. utf8 seems to conserve accents.

However, if I open the file with Notepad in Win32 and save it, it is growing by 3 bytes. Since I have a checksum on the file this is causing my program to flag a corrupt file.

I created the text files on linux with featherpad, used unix2dos to add the CRLF and then did my checksum.

I need to find a stable format.

marcov:
Probably notepad adds a BOM. You can avoid the differences by adding a BOM in the original file (and hope neither featherpad or unix2dos remove it)

domasz:

--- Quote from: lazer on November 03, 2022, 11:43:32 am ---Yes, you are correct. utf8 seems to conserve accents.

--- End quote ---
Install a hex editor. HxD is free and pretty nice. Then you will be able to see differences. In this case those few bytes are UTF-8 BOM.

Navigation

[0] Message Index

[#] Next page

Go to full version