I am working on iOS7 with RubyMotion 2.34, Motion-bundler 0.2.1, and rubysl-rexml 2.4.1.
I've gotten the following error when trying to parse an XML response from a server, down in the encoding part of REXML. However, I've also done the following to isolate the problem, which is what REXML library does to the string it is given:
def content
@s = @response.body.to_s
puts @s.encoding
@s.encode("UTF-8")
end
where @response
is the return from AFMotion::HTTP.get("http://....")
call. It's just a simple XML string with nothing but plain US-ASCII characters in it. I get the following error:
2014-10-02 18:34:14.714 promotion-motion-kit[44375:1346884] *** Terminating app due to uncaught exception 'RuntimeError', reason: 'http_client.rb:17:in
block in content': this operation cannot be performed with encoding
UTF-8' because Apple's ICU does not support it (RuntimeError) from http_client.rb:15:in `content'
I also get the EXACT same error (noting the UTF-8) when I change the code to:
@s.encode("US-ASCII")
So, it seems that it does not matter what I give String#encode
as long as it is a valid encoding name.
UPDATE: This error raises with ANY string I use, such as:
"hello".encode("UTF-8")
Doesn't anybody know how to rectify this situation?