KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums kdb+ Char datatype and Unicode? Can 8 bit chars

Tagged: ,

  • rocuinneagain

    Member
    February 18, 2025 at 5:01 pm

    The unicode characters use more than a single byte

    q)s:"tést" / Store text with unicode to variable
    q)s / Unicode bytes displayed
    "t\303\251st"
    q)count s / 2 bytes are used by é
    5
    q)-1 s; /Print to standard out presents the unicode characters again.
    tést
    

  • pgyorok

    Member
    February 18, 2025 at 5:32 pm

    Indeed the doc is inaccurate in that it’s not the byte or character type itself that can hold unicode characters, but the lists of these types can by virtue of having a character span multiple elements of the list.

    • MilanGill

      Member
      February 19, 2025 at 11:51 am

      Thank you, that makes sense.

      In this sense, `char` is very much like the C or C++ interpretation of “char”. In that it is a single byte. It may contain a valid ASCII value, or it may be part of a codepoint of some larger UTF-8 sequence of bytes.

Log in to reply.