Given I run this command:
$ defaults write com.example.encoding room -string "Baño"
plutil
shows that it is properly stored in UTF-8, and the character is correct:
$ plutil -convert xml1 ~/Library/Preferences/com.example.encoding.plist -o -
<?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>room</key>
<string>Baño</string>
</dict>
</plist>
I can also get this value from PlistBuddy
:
$ /usr/libexec/PlistBuddy -c "Print :room" ~/Library/Preferences/com.example.encoding.plist
Baño
However - if I try using defaults read
, the value comes back garbled - the special character (ñ
) does not get returned correctly:
$ defaults read com.example.encoding room
Ba\361o
Is there some way to set the encoding that defaults read
uses?