Shop OBEX P1 Docs P2 Docs Learn Events
How to read unicode files. — Parallax Forums

How to read unicode files.

KyeKye Posts: 2,200
edited 2010-03-13 23:53 in Propeller 1
So I have a file. I know it has text in it but I don't know if it's plan text or unicode plain text.

How would I print the file out like if I were using the UNIX CAT command?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-03-13 05:42
    It depends on the format. A UTF-16 file, for example, will start with FE FF, after which all characters are two bytes apiece. Some time spent with Google should be enough to ferret out the headers for the other formats.

    -Phil
  • jazzedjazzed Posts: 11,803
    edited 2010-03-13 06:06
    The TYPE command under Vista's cmd shell seems to handle it automatically.
    Here's a linux unicode page hektor.umcs.lublin.pl/~mikosmul/computing/articles/linux-unicode.html

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Short answers? Not available at this time since I think you deserve more information than you requested.
  • KyeKye Posts: 2,200
    edited 2010-03-13 14:10
    Cool, I'm trying to CAT spin files using my file system and its been not so easy so far.

    <EDIT>

    Actually typing in UTF in google is not giving me the best results. This is why I am posting on the fourm. Just how would I print out a UTF or regular ASCII spin file to the parallax serial terminal?

    Would I look for FF FE first to see if the file is UTF 16 and then read and interpret every two bytes after that? If that is all then where can I find the lookup table I need to read and understand what the propeller tool uses for its unicode characters.

    I know how to print out plain text. That's pretty easy.

    Thanks,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,

    Post Edited (Kye) : 3/13/2010 2:32:39 PM GMT
  • w8anw8an Posts: 176
    edited 2010-03-13 14:46
    Start here
    Wikipedia
    then check the See Also section

    -Steve
  • Duane DegnDuane Degn Posts: 10,588
    edited 2010-03-13 23:23
    Kye - I once needed to insert text within a unicode file. I got away with just alternating $00 with a byte of the desired text. Of course all the inserted text was standard ASCII characters. Since I was just alternating an existing file, I left the header information the same as in the original file.

    Duane
  • AribaAriba Posts: 2,690
    edited 2010-03-13 23:53
    Kye said...
    ...Would I look for FF FE first to see if the file is UTF 16 and then read and interpret every two bytes after that? If that is all then where can I find the lookup table I need to read and understand what the propeller tool uses for its unicode characters...

    Yes, that's the way.
    You find the Unicode values in the CharacterChart in the PropTool.

    Attached is a table that I use in one of my Tools to translate the Propeller character codes to Unicode. I don't know if the
    PST shows the none ASCII character codes in the same way as the Propeller font.

    Andy
Sign In or Register to comment.