Forum Discussion

asenthil's avatar
asenthil
Visitor
15 years ago

Brightscript Unicode support

Hi,

I came across this reply below in the forum.

"RokuKevin" wrote:
We have not added unicode (utf-8 or utf-16) support to BrightScript yet... There may be a few places where BrightScript assumes utf-8 (like in the manifest file), but the parser is not one of them.

Displaying multi-byte characters like chinese in BrightScript strings is not possible on the Roku box at this time.

--Kevin


I would like to know if the latest Brightscript version has UTF-8 support in it. I have to include the standard Registered symbol and Trademark symbol in a couple of places in my application. The reply above says that the manifest file might have UTF-8 support but when i tried inserting Registered symbol in the title of the application in the manifest file, the entire title string did not get displayed! But in Welcome screen it displays junk characters in the place of the special characters while the other characters of the paragraph text string got displayed properly. Guidance of any sort will be much appreciated. Thank you.

8 Replies

  • Hey Patrick,

    Thank you for the quick response! Do you have an ETA on the version with UTF8 support?
  • Full utf-8 support is not coming in the near future. However, the title in the manifest is one of the places that should work. Here's an example:

    title=Your Channel®
    subtitle=You channel subtitle
    mm_icon_focus_hd=pkg:/images/MainMenu_Icon_Center_HD.png
    mm_icon_side_hd=pkg:/images/MainMenu_Icon_Side_HD.png
    mm_icon_focus_sd=pkg:/images/MainMenu_Icon_Center_SD43.png
    mm_icon_side_sd=pkg:/images/MainMenu_Icon_Side_SD43.png
    major_version=1
    minor_version=0
    build_version=00001
  • Is there any workaround? May be through custom fonts or pre-rendered images?
  • "RokuPatrick" wrote:
    Sorry, no, the latest SDK did not at Unicode support.


    RokuPatrick,

    Aside from adding UTF-8 support in areas other than the manifest, I suggest two things Roku might want to change related to this topic today:

    1) Update the BrightScript Reference Guide to be more clear and note that the current ASCII support is limited to 7-bit ASCII (not 8-bit).
    There are various 8-bit ASCII charsets in common use out there. In fact, they are so common on other platforms that I'd bet most Roku programmers
    with other platform experience expect some variant of the ISO-8859 charset (which is 8-bit ASCII) when the manual says "ASCII is supported".
    I know I expected 8-bit ASCII support, and got a surprise when I tried to use the chr() function to produce visible Copyright and Registered Trademark characters outside the channel title/subtitle...

    2) As long as it's limited to 7-bit ASCII support, update the Roku box parser to reject (throw a runtime error) when any value outside of 0-127 is passed into the chr() function.
    If you pass in a value greater than 127 today, under some circumstances, it can cause an unexpected hang and/or reboot of the Roku box.

    Cheers
  • ASCII is by definition a 7-bit character set. There's no such thing as "8 bit ASCII" to the best of my knowledge. ISO-8859 is a separate character set and is not ASCII.

    Can you provide an example of code that hangs or crashes the box when you pass a non-ASCII value to chr()?

    --Mark
  • jbrave's avatar
    jbrave
    Channel Surfer
    FYI the roku can in fact display characters with umlauts and accent grave' etc in you just have to hack around with it.
  • "RokuMarkn" wrote:
    ASCII is by definition a 7-bit character set. There's no such thing as "8 bit ASCII" to the best of my knowledge.


    Technically true, but the term "8-bit ASCII" is in common usage. Google "8-bit ASCII" and you'll see what I mean.

    "RokuMarkn" wrote:
    ISO-8859 is a separate character set and is not ASCII.


    Also technically true, but the underlying point is that ISO-8859-1 and other similar 8-bit "ascii-like" character sets are in common use as the default character set on other languages/platforms. I don't know of many languages/platforms in current use that don't support an 8-bit "extended ASCII" (also a commonly used term) charset by default.

    "RokuMarkn" wrote:
    Can you provide an example of code that hangs or crashes the box when you pass a non-ASCII value to chr()?


    Will do. I'll send you a PM with the code when I get chance to recreate it (it's been a while since I even tried something over 127 when using chr() - I learned the lesson immediately 🙂 ).