-1

Hello I need to encode a string with 'Ñ' I'm doing a connection with a provider sending this data Base64.encode64('Muñoz') for example but when the provider decode this string he see this string "Mu\xC3\xB1os", How I can encode correctly the string?

Base64.encode64('Muñoz')
Base64.decode64(base64) == Muñoz
engineersmnky
  • 25,495
  • 2
  • 36
  • 52

1 Answers1

0

See this question, which describes the encoding issue you are seeing, along with a solution using force_encoding:

Base64.decode64(encode).force_encoding('UTF-8')
goatshriek
  • 133
  • 6