Skip to content

Issue with Retrieving UTF-8 Encoded JSON String Using json_GetStr in NoxDB #102

Description

@RootDeepak

Hi Niels,

I'm currently working with NoxDB and encountering an issue when handling UTF-8 encoded JSON data. Specifically, I'm using the following line to parse the JSON string:

The pResponse.records(1).record is a pointer that contains UTF-8 encoded JSON. The hexadecimal representation of this data is:

5B7B2273 686F7274 46697844 65736372
69707469 6F6E223A 22E0A4A6 E0A58BE0
A4B9E0A4 B0E0A4BE 227D5D40 40404040

When converted, this resolves to the following JSON content:

[{"shortFixDescription":"दोहरा"}]

To process this, I'm using an iterator with the following logic:

SQLRecords = json_ParseString(pResponse.records(1).record);
SQLRecord = json_getChild(SQLRecords);
Dow SQLRecord <> *Null;
recordField = Json_NewObject();
iterator = json_setIterator(SQLRecord);

Dow json_ForEach(iterator);
keyName = json_getName(iterator.this);
Json_SetStr(recordField: %Trim(keyName): json_GetStr(iterator.this));
EndDo;
SQLRecord = json_getNext(SQLRecord);
EndDo;

Here’s the issue I’m facing:

The key name (shortFixDescription) is being retrieved correctly.

However, the corresponding value is coming through as blank, even though the original UTF-8 JSON string contains the Hindi word "दोहरा".

My question is:
Is there a known issue with json_GetStr in handling UTF-8/multi-byte characters? Or is there a required conversion or workaround needed to retrieve values like this correctly?

Any help or guidance you can provide would be greatly appreciated.

Thanks & Regards,
Deepak Mishra

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions