Skip to content

[SR-6314] Swift will not deserialize a JSON object with unicode character FEFF as property name #4062

Open
@swift-ci

Description

@swift-ci
Previous ID SR-6314
Radar None
Original Reporter mark.probst (JIRA User)
Type Bug

Attachment: Download

Environment

Apple Swift version 4.0.2 (swiftlang-900.0.69.2 clang-900.0.38)

Target: x86_64-apple-macosx10.9

Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug, Codable
Assignee None
Priority Medium

md5: 3dc0fb1b6152165425ac5ac8aad629d6

Issue Description:

I'm trying to decode a JSON object that has a property whose name is the sole unicode character FEFF, which does not work. 200B works, for example. This is the type:

struct TopLevel: Codable {

{{ let empty: String}}

{{}}}

extension TopLevel {

{{ enum CodingKeys: String, CodingKey {}}

{{ case empty = "\u{feff}"}}

}

{{}}}

and this is the JSON:

{

{{ "\ufeff": "foo"}}

{{}}}

I've attached a test case. Compile it and invoke it with

./a.out blns-object.json

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions