How to convert unicode into a string?

3 ビュー (過去 30 日間)
Ive J
Ive J 2016 年 8 月 28 日
編集済み: Hoa Nguyen 2020 年 2 月 5 日
Hi,
I have the following string, I want to know how can I convert it into a regular string (it is originally contains arabic characters)?
\u062a\u0648\u062f\u0647 \u0648 \u0634\u0645\u0627\u0631 \u0633\u0627\u0632\u0648\u0627\u0631\u0647\u0647\u0627\u06cc \u0632\u0646\u062f\u0647 \u062f\u0631 \u062c\u0627 \u06cc
Thanks in advance.

採用された回答

Guillaume
Guillaume 2016 年 8 月 28 日
Unicode support is not very well explained in the doc. But it would appear that the following would work:
codedstring = '\u062a\u0648\u062f\u0647 \u0648 \u0634\u0645\u0627\u0631 \u0633\u0627\u0632\u0648\u0627\u0631\u0647\u0647\u0627\u06cc \u0632\u0646\u062f\u0647 \u062f\u0631 \u062c\u0627 \u06cc';
decodedstring = sprintf(strrep(codedstring, '\u', '\x'))
sprintf documentation states that \x is supposed to specify an ascii code, but it seems that actually it supports unicode, not ascii.
  3 件のコメント
Le Dung
Le Dung 2019 年 1 月 24 日
Dear Guillaume.
How about to Vietnamese?
I want to insert a string "cáp dự ứng lực" (cáp dự ứng lực is vietnamese) into listbox. But, it is mistake in font?
Untitled111111111.png
Hoa Nguyen
Hoa Nguyen 2020 年 2 月 5 日
編集済み: Hoa Nguyen 2020 年 2 月 5 日
@Le Dung
Use these unicode point: '\u63\ue1\u70 \u64\u1ef1 \u1ee9\u6e\u67 \u6c\u1ef1\u63'
Tell me if it works.
Regards,

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by