Seminko

Special characters, how I hate you

13 posts in this topic

Hey fellas,

I have a bunch of words full of special characters like: künstler, アーティスト, 아티스트, художник, ศิลปิน, 畫家 and many many more.

I have those along with other text in an array. For the text to correctly display in the array I used BinaryToString("text", 4) and it works PERFECTLY.

However, when I do FileWrite("file.ini", array[1]), it skips the special chars replacing them with ' ? '.

I tried using FileOpen, which doesn't help a bit. Also tried FileOpen with mode 128 or 256 but with those modes, nothing is written to the file AT ALL.

Any ideas?

Thx

Share this post


Link to post
Share on other sites



Are you trying to read the file with IniRead, seeing as it's an ini file?


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

I will do that but afterwards. Now I'm trying to create the ini file with all the special chars. (and, I can't use IniWrite just yet)

Share this post


Link to post
Share on other sites

Works fine for me when simply doing:

FileWrite("file.ini", "アーティスト, 아티스트, художник, ศิลปิน, 畫家 ")

then opening file.ini with SciTE.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
2 minutes ago, Jos said:

Works fine for me when simply doing:

FileWrite("file.ini", "アーティスト, 아티스트, художник, ศิลปิน, 畫家 ")

then opening file.ini with SciTE.

Jos

This is what I see when I open the INI: ?—????, ????, ????????, ??????, ?? 

Share this post


Link to post
Share on other sites

How do you open the file?  and if with SciTE: what are the file encoding settings when doing File/Encoding?

Jos 


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Double clicking it, not by a script. If I use a script to then read the ini, it will work? That seems so counter intuitive...

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

You're not answering my question .... :)

What editor are you opening the "file.ini" in when you double click it?

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Oh sorry, my bad. Actually it is the good ol notepad. Even notepad++ only sees questionmarks...

EDIT: even scite...

Edited by Seminko

Share this post


Link to post
Share on other sites

Ok, lets take this from the start:

  1. copy the line I posted in a new script that has the correct encoding, save and run it.
  2. check the created file.ini.
  3. if still wrong then zip the 2 files and PM the zip file to me.

ps: which Scite version are you using? 

Jos

1 person likes this

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Sent

Share this post


Link to post
Share on other sites

Jos' solution: update NOT ONLY SciTE but also Autoit3 :). With the latest version works great!

Thanks again Jos!

Share this post


Link to post
Share on other sites

You shouldn't need to create the file with anything other than IniWrite or IniWriteSection. There's no reason to use FileWrite first.

If you want your INI file to be unicode compatible look here for how to do it.

 


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now