简体   繁体   中英

Print/output utf-8 character from utf-8 code

I have string containing utf8 code in my HTML file such as /tr'ʌmpɪt/ , I want the utf8 code to be printed as utf8 character in the document. ˈtrəmpit

Which library provide this functions? Ruby , JavaScript all works for me, Python is also okey.

Provided the document is already encoded in utf-8.

For Python, use eg (following this post ):

import HTMLParser
h=HTMLParser.HTMLParser()
print h.unescape('trʌmpɪt')
# trʌmpɪt

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM