1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WAD utf8decode string only results in ? chars

Discussion in 'Support' started by Juppycmd, Feb 13, 2015.

  1. Juppycmd

    Joined:
    Dec 10, 2014
    Messages:
    61
    Likes Received:
    1
    The rather "limited" utf8 support in tcc wouldn't be so bad if you could force a conversion on input/output and otherwise treat stings with the default non-utf codepage. At least @UTF8ENCODE[s,...] works fine, but %@UTF8DECODE[s,...] only returns ? chars whatever code page I've set. The manual reads:

    "@UTF8DECODE[s,string] : Create a text string (using the current code page) from a UTF8 input string. Returns the text string."

    But if I run the attached utf8-encoded batch file containing a test string I get
    Active code page: 1252
    Test???????
    Active code page: 850
    Test???????
    Active code page: 65001
    Test???????
    Active code page: 437
    Test???????

    How is @UTF8DECODE[s,...] supposed work, am I missing something here?
     

    Attached Files:

    • bug.bat
      File size:
      155 bytes
      Views:
      3
  2. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,869
    Likes Received:
    83
    In v17, the batch file is recognized as UTF8, and the string has already been converted from UTF8 before calling @UTF8DECODE. So your @UTF8DECODE results in it being doubly converted (to gibberish).
     
  3. Juppycmd

    Joined:
    Dec 10, 2014
    Messages:
    61
    Likes Received:
    1
    Right, thanks. That's certainly not self-explanatory, maybe an addition to the @UTF8DECODE function in the help might be appropriate.
     

Share This Page