node-bplist-creator icon indicating copy to clipboard operation
node-bplist-creator copied to clipboard

é is converted to é

Open godspeedelbow opened this issue 10 years ago • 1 comments

é is converted to é (String), if you open the binary plist file in Xcode (or on an iOS device).

When I change the Type to Data it is listed as <c383c2a9>.

Logging entry and utf8 values in bplistCreator.js on line 226, gives: entry { type: 'string', value: 'é', id: 2 } utf8 <Buffer c3 a9>

According to http://utf8-chartable.de/ the UTF-8 code for é is c3 a9, which make up the first and last two characters of <c383c2a9>. The code in between 83 c2 makes two characters: c383: Ã and c2a9: ©.

Input String Data
é é < c3 83 c2 a9 >
ê ê < c3 83 c2 aa >
ë ë < c3 83 c2 ab >
è è < c3 83 c2 a8 >

godspeedelbow avatar Apr 29 '14 12:04 godspeedelbow

It looks like somewhere UTF-8 text is being decoded as ISO-8859-1 or a similar text encoding.

There doesn't seem to be an issue here:

const fs = require('fs');
const bplist = require('bplist-creator');
const plist =  bplist({test: "é"});
fs.writeFileSync('test.plist', plist);
$ plutil -convert xml1 test.plist
$ cat test.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>test</key>
	<string>é</string>
</dict>
</plist>

dnicolson avatar Feb 27 '21 21:02 dnicolson