My code receives XML data from a Web Service API call that is in UTF8 encoding.
This winds up in a string.
return_data = NSURLConnection.sendSynchronousRequest(@request,
returningResponse: response, error: error)
str = NSString.alloc.initWithData(return_data, encoding:
NSUTF8StringEncoding)
puts "******* response encoding it #{str.encoding}"
The result of the puts above is 'MACINTOSH'.
I suspect the encoding of the string is not UTF-8, because when I try to parse
the XML using REXML, I get:
RegexpError: too short multibyte code
This occurs way in REXML:
/Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/ruby/1.9.0/rexml/text.rb:132:in
`check:'
In any case, my questions are:
1) If anyone has run across this what did you do?
2) Why might the encoding be MACINTOSH and not UTF-8, as specified in the
initWithData method call?
3) Suggestions?
Thanks,
Steve_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel