Skip to content
This repository was archived by the owner on Apr 10, 2019. It is now read-only.
This repository was archived by the owner on Apr 10, 2019. It is now read-only.

-[NSString jsonStringValue] not handling unicode chars #2

Description

@smorr

Strings such as später are being encoded as sp‰ter

Possible Solution:
replace
default:
-- [jsonString appendFormat:@"%c", nextChar];
++ [jsonString appendString:[NSString stringWithCharacters:&nextChar length:1]];
break;
or
default:
if (nextChar >0x7e){
[jsonString appendFormat: @"\u%04x", nextChar];
}
else {
[jsonString appendFormat:@"%c", nextChar];
}

Former will place the unicode char into the string itself (eg später)
latter will escape the unicode char (eg sp\u00e4ter)

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions