On Tue, May 30, 2006 at 09:33:32AM +0200, whamoo wrote:
> Hi all!
>
> i'm at war with unicode python and cocoa, and seem that i cannot
> win... =)
>
> i've wrote this function:
>
> def makeNSString(self, oldString):
> try:
> oldString = NSString.stringWithUTF8String_(oldString)
> return oldString
> except Exception, e:
> print Exception, e
> return oldString
>
> And it work, now in my app i have all the ?,?,?,? correctly written,
> but it raise this exception each time:
>
> exceptions.Exception depythonifying 'charptr', got 'unicode'
>
> This is normal? what can i do? ;)
What are you trying to do? If the string is already Unicode, PyObjC
will make it into a NSString for you. If you want to encode a Unicode
string as UTF-8, then use oldString.encode('utf-8').
--
Nicholas Riley <[EMAIL PROTECTED]> | <http://www.uiuc.edu/ph/www/njriley>
_______________________________________________
Pythonmac-SIG maillist - [email protected]
http://mail.python.org/mailman/listinfo/pythonmac-sig