Reading an UTF-8 encoded text file in Mathematica

后端 未结 1 1880
Happy的楠姐
Happy的楠姐 2020-12-29 09:12

How can I read a utf-8 encoded text file in Mathematica?

This is what I\'m doing now:

text = Import[\"charData.txt\", \"Text\", Char         


        
相关标签:
1条回答
  • 2020-12-29 09:21

    Short version: Mathematica's UTF-8 functionality does not work for character codes with more than 16 bits. Use UTF-16 encoding instead, if possible. But be aware that Mathematica's treatment of 17+ bit character codes is generally buggy. The long version follows...

    As noted by numerous commenters, the problem appears to be with Mathematica's support for Unicode characters whose codes are larger than 16 bits. The first such character in the cited text file is U+20B9B (

    0 讨论(0)
提交回复
热议问题