Page 1 of 2

SC: UTF-8 decoding the '§'?

Posted: 19 Sep 2017 06:40
by Filehero
Code pages, locales and transformations, my beloved topic. So I add :oops: the right upfront.

When run from XY's script editor (Run script...) this

Code: Select all

msg("§§ $ &");
shows what it should.

When this string sequence is read from an UTF-8 encoded script or ini file it (the paragraph char '§') shows up as

Code: Select all

msg("§§ $ &");
Why is that?

Re: SC: UTF-8 decoding the '§'?

Posted: 19 Sep 2017 08:57
by highend
A bug, it's read correctly from an UTF-8 with BOM

Re: SC: UTF-8 decoding the '§'?

Posted: 19 Sep 2017 09:50
by admin
If you want BOM-less UTF-8 detection you have to tick this:
Configuration | Preview | Text preview | UTF-8 auto-detection

Re: SC: UTF-8 decoding the '§'?

Posted: 19 Sep 2017 10:45
by highend
It's not about previewing files

Create two .xys files:
<xyscripts>\1.xys
<xyscripts>\2.xys

Save the first with UTF-8 BOM
and the second with UTF-8 (no BOM!)

Content of both

Code: Select all

msg("§§ $ &");
Execute them with "Scripting - Load Selected Script File"

The first displays the § correctly, the second does not.

Re: SC: UTF-8 decoding the '§'?

Posted: 19 Sep 2017 11:02
by admin
Setting "UTF-8 auto-detection" does not only affect preview, but reading UTF8 files in general.

Re: SC: UTF-8 decoding the '§'?

Posted: 19 Sep 2017 11:05
by highend
That may be the case but it fails on this specific case.

UTF-8, no BOM .xys script file and
Configuration | Preview | Text preview | [x] UTF-8 auto-detection
-> Wrong display of §

Re: SC: UTF-8 decoding the '§'?

Posted: 19 Sep 2017 11:53
by admin
Okay, got it. It's a bug. Fix comes.

Re: SC: UTF-8 decoding the '§'?

Posted: 19 Sep 2017 13:06
by Filehero
Thanks highend for deeper analysis, thanks Don for fixing in advance.

Re: SC: UTF-8 decoding the '§'?

Posted: 21 Sep 2017 19:34
by Filehero

Code: Select all

v18.40.0001 - 2017-09-21 16:14
    ! Scripting | Load Selected Script File: Did not decode BOM-less 
      UTF8-encoded script files when "Configuration | Preview | Text preview | 
      UTF-8 auto-detection" was ON. Fixed.
Hmm, I still have this issue with 18.40.0002.

Re: SC: UTF-8 decoding the '§'?

Posted: 21 Sep 2017 19:39
by highend
Hmm, I still have this issue with 18.40.0002
Works fine here since 0001

Zip that script file and attach it?

Re: SC: UTF-8 decoding the '§'?

Posted: 21 Sep 2017 19:59
by Filehero
Key <key_var_group> / line 21

Re: SC: UTF-8 decoding the '§'?

Posted: 21 Sep 2017 20:24
by highend
Displaying the content after using readfile() works fine
so I guess you're using e.g. getkey()?

Re: SC: UTF-8 decoding the '§'?

Posted: 21 Sep 2017 20:26
by Filehero
highend wrote:so I guess you're using e.g. getkey()?
Yes. I should have mentioned it, sorry.

Re: SC: UTF-8 decoding the '§'?

Posted: 21 Sep 2017 20:37
by admin
BOM-less UTF-8 ini-reading is not supported. Simply add the BOM and all is good.

Re: SC: UTF-8 decoding the '§'?

Posted: 21 Sep 2017 20:49
by Filehero
Like this?
utf-8-bom.png
I know why I h*te this darn encoding hell, sorry for bothering..