KX Community

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

Home Forums kdb+ Unicode character conversion issue

  • Unicode character conversion issue

    Posted by denakaran on March 29, 2023 at 12:00 am

    Hi,

    While i was trying to convert the unicode character of �� is showing a different number.

    q)`$`char$147
    `�� />

    q)`$`char$244
    `?
    I could see the ASCII value for �� 244 but when i try it in the q terminal it is showing a different result as mentioned above. Also you could see the value of 147 gives me the expected result as ��bsp; I am not sure what is happening behind this.

    denakaran replied 8 months, 2 weeks ago 2 Members · 1 Reply
  • 1 Reply
  • rocuinneagain

    Member
    March 29, 2023 at 12:00 am

    Most modern shells will be UTF-8 encoded rather than ASCII.

    kdb+ is storing the information correctly – it is just being displayed differently than you expect.

    On my machine:

    $ locale LANG=C.UTF-8 LANGUAGE= LC_CTYPE=”C.UTF-8″ LC_NUMERIC=”C.UTF-8″ LC_TIME=”C.UTF-8″ LC_COLLATE=”C.UTF-8″ LC_MONETARY=”C.UTF-8″ LC_MESSAGES=”C.UTF-8″ LC_PAPER=”C.UTF-8″ LC_NAME=”C.UTF-8″ LC_ADDRESS=”C.UTF-8″ LC_TELEPHONE=”C.UTF-8″ LC_MEASUREMENT=”C.UTF-8″ LC_IDENTIFICATION=”C.UTF-8″ LC_ALL=

     

    UTF-8 encoding for �� 0xC3 0xB4

    Testing this in kdb+

    q)`char$0xC3B4

    “ô”

    q)`$`char$0xC3B4

    `��i-code>

     

    For your shell to print the extended ASCII table characters you will need to make some changes outside of kdb+.

     

Log in to reply.