[Solved] ITT: Encoding of .lng unstable, when in UTF-8

Things you’d like to miss in the future...
Forum rules
You might want to read this if you're looking for priority service

:info: Please Include The Following Information
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).

:info: Use Your Profile Or Signature
We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.

:info: How To Attach Images
When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".
Post Reply
Borut
Posts: 1472
Joined: 19 Oct 2010 19:29
Location: Win10 Pro 64b 22H2, @120DPI (125%)

[Solved] ITT: Encoding of .lng unstable, when in UTF-8

Post by Borut »

Some time ago I have re-encoded (via a third party editor) the .lng file I am being creating while translating into UTF-8. My rationale behind that: It is smaller for the future downloads and - as far as I remembered - this was defined as being supported. And so it was -no problems ever since.

However, today (with v11.90.0202) I came upon the wild idea to update it with a reference file 8.14, although there was no need for this (apart that I was expecting 8.15 to come up with v11.90.0202), since my .lng was already on the 8.14 level.

Well, the UTF-8 encoded characters appear to become destroyed with this procedure, so that after saving the .lng it is rendered pretty much useless. The backup is the only help (and I was on the safe side).

So, in short, special circumstances were:
1) .lng encoded in UTF-8 instead of the standard UTF-16;
2) unnecessary update of the .lng, which was already on the last available level.

Maybe it would be worth investigating this, although very special circumstances ware apparently necessary.
Last edited by Borut on 10 Jan 2013 00:29, edited 2 times in total.
Win 10 Pro 64bit

admin
Site Admin
Posts: 67315
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: ITT: Encoding of .lng, while searching for trouble

Post by admin »

I guess this is related to the recently fixed bug:

Code: Select all

    ! UTF8: UTF8 encoding and decoding (incl. SC utf8encode and 
      utf8decode) was potentially affected by the active codepage: The 
      results were not always correct when the active codepage was 
      different from 1252 (ANSI - Latin I). Fixed. The fix handles all 
      places where UTF8 is encoded or decoded.

Borut
Posts: 1472
Joined: 19 Oct 2010 19:29
Location: Win10 Pro 64b 22H2, @120DPI (125%)

Re: ITT: Encoding of .lng, while searching for trouble

Post by Borut »

Maybe. I have done some further testing in the meantime: It seems that it suffices to simply change anything in the translation and save - that seems to destroy the UTF-8 encoding of the non ASCII characters.

So, in my view, either the support of UTF-8 in .lng should be abandoned officially, or this negative side effect corrected.

Edit: Further details about my place:
System Locale ID: 1050
Thread Locale ID: 3079
Default ANSI Code Page: 1252
Active Code Page: 1250 (ANSI - Mitteleuropa)
Win 10 Pro 64bit

admin
Site Admin
Posts: 67315
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: ITT: Encoding of .lng unstable, when encoded in UTF-8

Post by admin »

Got it. :twisted: The error was not in the UTF-8 conversion (which indeed got correctly fixed) but in the file writing. The bytes got obviously mangled at one point. Fix comes.

Good bug!

Filehero
Posts: 2734
Joined: 27 Feb 2012 18:50
Location: Windows 11@100%

Re: ITT: Encoding of .lng unstable, when encoded in UTF-8

Post by Filehero »

admin wrote:Good bug!
You mean good bug hunter, right? :wink:


Cheers,
Filehero

Post Reply