cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
lala
Level VIII

怎样将特殊编码的字符转换为中文?

大家好!

我在网页下载得到的特殊编码的字符怎样用脚本转换为中文?

谢谢!

2022-05-04_21-10-45.png

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: 怎样将特殊编码的字符转换为中文?

Might have to do something fun like this with some escaping:

Names Default To Here(1);

input_str = "\u4e01\u516c\u85e4";

uni = "\[\!U]\";
quotationmark = "\!"";
converted_str = Eval(Parse(quotationmark||Substitute(input_str, "\u", uni)||quotationmark));
Show(converted_str);

There might (or might not) be easier way to do this, this idea is from +Re: Column Formula to convert Unicode to symbol  by @Craige_Hales 

-Jarmo

View solution in original post

5 REPLIES 5
lala
Level VIII

Re: 怎样将特殊编码的字符转换为中文?

The JSL command automatically converts.

d1=jsontodatatable(txt);
lala
Level VIII

Re: 怎样将特殊编码的字符转换为中文?

  • But how do  convert them individually? For example,

\u4e01\u516c\u85e4
\u4e01\u516c\u85e4 →丁公藤
jthi
Super User

Re: 怎样将特殊编码的字符转换为中文?

Try adding ! after \

jthi_0-1651672293106.png

You can find this info from JMP Scripting Guide and search for Unicode Characters or from unicode characters (jmp.com) 

 

-Jarmo
lala
Level VIII

Re: 怎样将特殊编码的字符转换为中文?

谢谢、我还是没有明白如何用脚本将它转换得到中文。

jthi
Super User

Re: 怎样将特殊编码的字符转换为中文?

Might have to do something fun like this with some escaping:

Names Default To Here(1);

input_str = "\u4e01\u516c\u85e4";

uni = "\[\!U]\";
quotationmark = "\!"";
converted_str = Eval(Parse(quotationmark||Substitute(input_str, "\u", uni)||quotationmark));
Show(converted_str);

There might (or might not) be easier way to do this, this idea is from +Re: Column Formula to convert Unicode to symbol  by @Craige_Hales 

-Jarmo