rebellion
rebellion

Reputation: 6740

App crashes when using international characters in NSDictionary

I am listing out data to a UITableView from a plist file where I have a two dimensional array/dictionary:

<?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">
<array>
    <dict>
        <key>ID</key>
        <integer>1</integer>
        <key>Title</key>
        <string>Middelthunsgate</string>
        <key>Description</key>
        <string>Vis-a-vis nr 21, retning Kirkeveien</string>
    </dict>
</array>
</plist>

(In case you're wondering, this is in Norwegian.) This works fine, until I start using some special Norwegian characters like æøå etc. The app builds without errors, but it crashes. I found out it was because I used the characters ø and é as the string for the Title key. When I removed that dictionary, it ran just fine again.

What can I do to make sure it reads fine, even with i18n characters?

Upvotes: 0

Views: 318

Answers (1)

kennytm
kennytm

Reputation: 523344

Make sure the plist is saved as UTF-8 encoding, instead of MacRoman.

Use the "Property List Editor" (comes with the iPhone SDK) so that you don't need to care about encodings.

Upvotes: 1

Related Questions