String encoding in Tcl_CreateCommand commands

From: Donald Arseneau (asnd_at_triumf.ca)
Date: 06/30/04


Date: 29 Jun 2004 20:33:36 -0700

I have an older application with an "old-style string-based"
command created with Tcl_CreateCommand. I wonder what, if
any, conversion Tcl performs on strings when it prepares the
argv argument list. It appears that the character encoding
in argv is UTF-8, regardless of the current LANG setting.
Is this the case?

Internal string-object encoding is unicode, right? It looks
like Tcl calls Tcl_UniCharToUtfDString, maybe, in preparing
the arguments. Well I thought it was unicode, but the Encoding
page says "Tcl's internal character representation, UTF-8".
Is that true?

Whichever the innermost workings, when I get a string, should
I then call Tcl_UtfToExternal to get the expected encoding?

Donald Arseneau asnd@triumf.ca



Relevant Pages

  • Re: Unicode/UTF-8 decoding
    ... I am using SQLyog to access mySQL remotely. ... This text looks as it has been decoded with a different encoding than ... If you want to store unicode strings in the MySQL database, ... While this gives the correct result for some strings, ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Best ways of managing text encodings in source/regexes?
    ... etc. when compiling regexes with python's re.UNICODE flag. ... the encoding of one's source strings when building regexes, ... READ TO/WRITE FROM UNICODE STRING OBJECTS. ...
    (comp.lang.python)
  • Re: Proposal: require 7-bit source strs
    ... I'm referring to a time when there was no encoding ... It would be possible to go back and find all strings ... That's why I specified to do this after conversion to ... make the assumption that the character set is ASCII-based, ...
    (comp.lang.python)
  • Re: pep 277, Unicode filenames & mbcs encoding &c.
    ... PEP 277 actually answers neither question. ... changes only affect Unicode strings passed to functions expecting file names. ... > system encoding to convert strings to Unicode, ...
    (comp.lang.python)
  • Re: Using Japanese and English strings, encodings
    ... English, and I keep wishing I could closely, reliable, and simply ... using edict + CLISP + araneida. ... It keeps screwing up the EUC-JP encoding of any parameters I ... Internally, strings are 16 bit characters, I think. ...
    (comp.lang.lisp)