INI file in UTF8 cannot be read by MS if non ANSI characters are in the file.

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
Grovkillen
Automation Wizard
Posts: 1128
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

INI file in UTF8 cannot be read by MS if non ANSI characters are in the file.

Post by Grovkillen » Fri Aug 06, 2021 11:38 am

Try this example, with WLN_ENCODING=UTF8 the last read command will return an empty string. Comment it out and it work.

Code: Select all

Let>WLN_ENCODING=UTF8
IfFileExists>%SCRIPT_DIR%\test.ini
  DeleteFile>%SCRIPT_DIR%\test.ini
Endif>
WriteLn>%SCRIPT_DIR%\test.ini,RES,#####
EditIniFile>%SCRIPT_DIR%\test.ini,section,entry,Value
ReadFile>%SCRIPT_DIR%\test.ini,FILE_CONTENTS
EditIniFile>%SCRIPT_DIR%\test.ini,section,entry,ÅÄÖåäö
ReadFile>%SCRIPT_DIR%\test.ini,FILE_CONTENTS
Last edited by Grovkillen on Sat Aug 07, 2021 7:15 am, edited 1 time in total.
Let>ME=%Script%

Running: 15.0.27
version history

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1378
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: INI file in UTF8 cannot be read by MS if non ANSI characters is in the file.

Post by Dorian (MJT support) » Fri Aug 06, 2021 11:45 am

I'll mark this for Marcus for his input.
Yes, we have a Custom Scripting Service. Message me or go here

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts