Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Encoding of Ini-Files

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Globalizer Support
View previous topic :: View next topic  
Author Message
hofingerandi



Joined: 29 Nov 2010
Posts: 19

PostPosted: Wed Sep 28, 2011 6:28 am    Post subject: Encoding of Ini-Files Reply with quote

I am trying to translate an ini-file using globalizer. (The file contains only translation text, no configuration or the like.)

The existing text-files use different encodings, e.g., lang.de.ini uses ISO-8859-1, lang.ja.ini uses Shift-JIS, ...

When I import the translations, Globalizer obviously does not respect these different encodings. Instead of japanese signs, some broken text is displayed.

---

What I also tried was saving a japanese file. First I created a small ini-file
Quote:
[text]
value=hello world

I imported the file. Then I used auto-translation to generate japanese text and built the japanese ini-file. The resulting file is broken. This is how the file looks like
Quote:
[text]
value=???????

and what my hex-editor tells me
Code:
5B 74 65 78 74 5D 0D 0A 76 61 6C 75 65 3D 3F 3F 3F 3F 3F 3F 3F 0D 0A 0D 0A 0D 0A

(note that the question marks a not a displaying error, but actually stored in the text file).

While I could probably solve the import problem by converting the japanese file to an apropriate encoding (which is ....?), I have no idea how to overcome the export problem.

---

When I changed my system settings to japanese (Regional and Language Options -> Advanced -> Language for non-Unicode programs), both import and export worked well (of course only for japanese, not e.g. chinese).
Back to top
View user's profile Send private message
sheitman



Joined: 27 Apr 2010
Posts: 98

PostPosted: Wed Sep 28, 2011 8:22 am    Post subject: Reply with quote

is there a reason you can not use utf 8 or utf 16? i guess utf 8 is used to read the files.
Back to top
View user's profile Send private message
hofingerandi



Joined: 29 Nov 2010
Posts: 19

PostPosted: Wed Sep 28, 2011 8:38 am    Post subject: Reply with quote

I created a sample file lang.ja.ini encoded in Utf8. When I choose "Scan all Cultures", then no translation is found in this file (also no error message is given).

I then resaved the file as Utf8 without BOM. Now "Scan all cultures" finds a translated value, but it is corrupted.

In both cases, the ini-file was displayed correctly by Notepad++ and Windows Notepad.
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Wed Sep 28, 2011 10:43 am    Post subject: Reply with quote

If you can email some examples of the files you are trying to scan to support@infralution.com then we will take a look at the issue.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Thu Sep 29, 2011 12:35 am    Post subject: Reply with quote

Thanks for sending the files - it helped determine the issue. Globalizer uses the standard Win32 API methods GetPrivateProfileString and WritePrivateProfileString for handling INI files. This API only supports either ASCII or Unicode files (not UTF-8).

So to get the INI files to work you need to save the Invariant Ini file in the Unicode format. I tested this by saving the invariant files using Visual Studio (Advanced Save Options) with Unicode - Code Page 1200. The file then scanned correctly and when translated into Japanese and built the built files were also correct.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
hofingerandi



Joined: 29 Nov 2010
Posts: 19

PostPosted: Thu Sep 29, 2011 7:00 am    Post subject: Reply with quote

Thanks, this helps!

Since our software uses a different naming convention (english.ini, german.ini, ...) than Globalizer (lang.ini, lang.de.ini, ...), I have to write some batch for converting files from and to Globalizer anyhow.
I suppose an additional step that converts via iconv should not be too difficult.

Btw, in Notepad++ the appropriate encoding is called "UCS-2 Little Endian". In iconv it is called "UCS-2LE" or "UNICODELITTLE".
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Globalizer Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group