Skip to main content
Participant
March 10, 2023
Answered

Wrong character encoding in ScriptUI panel

  • March 10, 2023
  • 2 replies
  • 2047 views

I built a ScriptUI panel and suddenly all non ASCII-characters are mixed up:

The last word should read »löschen« (= delete in German).

The problem happened before and disappeared after a while. 
I have absolutely no idea, wheather what caused it nor what caused it to go away. 

Any idea, how to fix this (other than using ASCII only)?
I couldn’t find anything on this issue.

Thanks, Martin

 

Correct answer m1b

One thing I would try is save the script file (actually I mean whichever file contains the string) as UTF-8 with BOM. For example, in VSCode, look down near the bottom right corner of window for the encoding. It might be UTF-8 by default. Click it and change it.

- Mark

2 replies

Community Expert
June 21, 2023

Hi @marbay ,

I see something similar with ScriptUI. However, I do not think it's an issue with UTF-8 with or without BOM.

So my post is meant for people who cannot solve the issue by using UTF-8 with BOM.

 

I see the issue with InDesign 2023 on macOS. Had no chance to test it with Windows as well. Will do later…

 

Two cases:

[1] My string contains the German word "Maße" and shows up as "Ma√üe" in one of my ScriptUI "edittext" fields.

[2] In the same script "Maße" shows up as "Maße" in a different ScriptUI "edittext" field as it should be.

 

Here comes the difference:

In case [1] the string is extracted from an IDMS file using ExtendScript (JavaScript) XML's xpath() method.

I open the IDMS file with file.open("r") and write its contents to a variable with file.read().

Then the string is used with new XML(string) where xpath() is fetching a distinct attribute in the code; "Maße" is part of an XML attribute in the IDMS file. ( I cannot change that, e.g. using a double s for the ß, because I have no say how the attributes are defined.)

 

In case [2] the string is written from an InDesign's text frame contents property. No issue with that using it as contents of a ScriptUI "edittext" field.

 

Not tested yet:

As a workaroud I will substitute "√ü" with "ß" before assigning the extracted text to the "edittext" field.

I'll do that also for any transformed umlauts that will show up in XML attribute definitions.

 

Thank you for bringing up the issue, Martin!

 

Regards,
Uwe Laubender
( Adobe Community Expert )

 

m1b
Community Expert
Community Expert
June 21, 2023

@Laubender, so have you tried manually saving the IDMS with BOM and no change?

Community Expert
June 21, 2023

@m1b said: "… have you tried manually saving the IDMS with BOM …"

 

Good idea!

I'll come back after doing more tests.

( But it can take a while; working on different things right now…)

 

Regards,
Uwe Laubender
( Adobe Community Expert )

m1b
Community Expert
m1bCommunity ExpertCorrect answer
Community Expert
March 10, 2023

One thing I would try is save the script file (actually I mean whichever file contains the string) as UTF-8 with BOM. For example, in VSCode, look down near the bottom right corner of window for the encoding. It might be UTF-8 by default. Click it and change it.

- Mark

marbayAuthor
Participant
March 10, 2023

Great, that did it!
I still have no clue, how this could have changed by itself. 
Thanks a lot!

- Martin