Hi, I’ve added a method “multi_capitalize” to String class. This
method is done in C and basically modifies the string:
“record-roUTE”.multi_capitalize => “Record-Route”
The problem is that after the method execution, the new String has
ASCII-8BIT encoding, while the original string had UTF-8 (using Ruby
irb> hname = “record-rouTE-â‚¬”
irb> hname2 = hname.multi_capitalize
“Record-Route-\xE2\x82\xAC” <------- !!!
#Encoding:ASCII-8BIT <------- !!!
What should I add to my C method to mantain the UTF-8 codification
after the changes in the string?
Could I invoke the C “force_encoding()” function from the C code
before returning the modified string? How to invoke it?
Thanks a lot.