Shop OBEX P1 Docs P2 Docs Learn Events
PATCH: Add unicode/UTF-8 support to SIDE — Parallax Forums

PATCH: Add unicode/UTF-8 support to SIDE

pedwardpedward Posts: 1,642
edited 2012-05-09 09:32 in Propeller 1
Attached is a patch that makes SIDE properly open and save UTF-8 encoded Unicode files. I was able to load and save the sample text from the other thread.
854 x 683 - 69K
611 x 375 - 8K

Comments

  • pedwardpedward Posts: 1,642
    edited 2012-05-09 00:17
    Terminal needs some work to display Unicode properly. Right now it's processing input 1 byte at a time. Due to the escape handling, it will need to be UTF-8 aware, which doesn't look like a big problem. I'll work on this tomorrow.
  • jazzedjazzed Posts: 11,803
    edited 2012-05-09 01:45
    I just noticed this. Great++ :)

    My openFileName change is a little different. The saveFile change was identical.
    Pros or cons? Seems like we don't need to use QByteArray for this approach.
                 QTextStream in(&file);
    +            in.setCodec("UTF-8");
                 data = in.readAll();
    

    If you look at the terminal that frees me up to do other things.
    I'll push my current console.cpp change which is a little more manageable.

    Let me know if you need anything.
    Send your gmail account on PM and I'll add you to contributors.

    Thanks!
    --Steve
  • pedwardpedward Posts: 1,642
    edited 2012-05-09 09:32
    If that works, great! I was working from the approach that UTF-8 is 8bit and all of the handlers needed to be 8-bit clean. However, if Qt has "smart" UTF-8 handling, as long as that works, I don't see any reason not to use that.
Sign In or Register to comment.