I have a problem saving the SetupString returned from PrinterSetup.PageSetupDialog in Cocoa.
In my program I use a class ‘XPrefs’ which uses XMLDocument and Dictionarys to store Preferences.
If I try to store the Printer SetupString as a String Preference the program crashes and the Preference File is empty.
In Cocoa, I am able to store and retrive the SetupString in a Static String Variable or in a pure TextFile - that works.
Saving the Printer SetupString in the very same ‘XPrefs’ class compiled in Carbon is also working without problems.
What I’m missing ?
How can I store the Printer SetupString with NSUserDefaults ?
What encoding is set on the string that is returned. I suspect the XMLDocument requires UTF-8 and is very prone to crashing if provided with anything else. If the encoding is nil that would cause the problem.
If it claims to be UTF-8 but the byte sequences are not actual UTF-8 characters then that will cause a problem. Just because something is labelled as UTF-8 doesn’t mean it really is UTF-8.