spotfiresoftware / spotfire-mods

Spotfire® Mods
https://spotfiresoftware.github.io/spotfire-mods/
Other
56 stars 41 forks source link

How to solve Chinese garbled characters #143

Closed jasperatnanjin closed 5 months ago

jasperatnanjin commented 6 months ago

Hi I found a problem The values assigned to document properties are Chinese garbled characters when I write data by use script: let modsInteractiveparamsDocument = await mod.document.property("modsInteractiveparamsDocument");
let a = '患者人口学' modsInteractiveparamsDocument.set(a) I found my properties value is \u5c31\u8bca\u4fe1\u606 ,is not "患者人口学" do you know why? can how to resolve it

ebrandin commented 5 months ago

Hi @jasperatnanjin

I cannot reproduce the issue that you are reporting. Which version of Spotfire are you seeing this issue? Where do you see this garbled value? If it is in your code, are you perhaps escaping the document property when reading?

jasperatnanjin commented 5 months ago

Hi @ebrandin

thanks for you reply and I have found the reason Because I used the following script to cause Chinese garbled characters: Document.Properties["tableToCollapsibletablesDocumentProperties"]=json.dumps(jsonObject) now the problem has been resovled when I replace this scipt to Document.Properties["tableToCollapsibletablesDocumentProperties"]=json.dumps(jsonObject,ensure_ascii=False)

thanks