nthState / Haptrix

Haptrix is a Haptic Experience Designer App. We have a macOS, iOS and Swift Package
https://www.haptrix.com
7 stars 1 forks source link

Export AHAP files using SPACE separators instead of NO-BREAK SPACE #30

Closed IsaiahJTurner closed 3 years ago

IsaiahJTurner commented 3 years ago

NO-BREAK SPACE is incompatible with many JSON parsers including JSONSerialization.jsonObject.

I work around this by doing: replacingOccurrences(of: " ", with: " ") on the AHAP string data but this is technically an invalid parsing since NO-BREAK SPACE could appear within JSON strings.

Per, RFC 7159 The JavaScript Object Notation (JSON) Data Interchange Format:

Insignificant whitespace is allowed before or after any of the six structural characters.

  ws = *(
          %x20 /              ; Space
          %x09 /              ; Horizontal tab
          %x0A /              ; Line feed or New line
          %x0D )              ; Carriage return
IsaiahJTurner commented 3 years ago

Actually, I realize this may be an issue on my own end from parsing the pasteboard.