MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Import, ReadList, and Unicode

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115151] Import, ReadList, and Unicode
  • From: eros olmi <erosolmiz at hotmail.com>
  • Date: Sun, 2 Jan 2011 06:22:38 -0500 (EST)

In Mathematica v8 i am using this convoluted way to read the contents of a unicode file saved in utf-8 format
txt = Import["file.txt",CharacterEncoding -> "UTF-8"]
w = ReadList[StringToStream[txt], Record, RecordLists -> True]
the output like this:
{{unicode chars},{unicode chars},{unicode chars}}
the letters displayed correctly even if i don't use CharacterEncoding -> "UTF-8"
but using
ReadList["file.txt", Record]
will return the file as a  garbage characters , and setting $SystemCharacterEncoding = "UTF-8"
$CharacterEncoding = $SystemCharacterEncoding
does not cure the problem since ReadList can't accept CharacterEncoding -> "UTF-8" in its syntax unlike Import.
are there some cure to this phenomena.
thanks
eros


  • Prev by Date: Re: Thread vs MapThread with Compiled functions
  • Next by Date: ReadList - Import - and Unicode
  • Previous by thread: Re: How does Plot work?
  • Next by thread: Re: Import, ReadList, and Unicode