3 steps to fix encoding problems in Ruby

You only really think about a string’s encoding when it breaks. When you check your exception tracker and see

1 Encoding::InvalidByteSequenceError: "\xFE" on UTF-8

staring you in the face. Or maybe “they’re” starts showing up as “theyre”.

So, when you have a bad encoding, how do you figure out what broke? And how can you fix it?

What is an encoding?

If you can imagine what encoding does to a string, these bugs are easier to fix.

You can think of a string as an array of bytes, or small number...

 •  0 comments  •  flag
Share on Twitter
Published on September 15, 2015 23:59
No comments have been added yet.