0

I am using an XML request to send SMS. It has UTF-8 encoding, but my string is in Norwegian.

Here part of my string:

Trykk på linken for å få

In SMS I get this:

"Trykk på linken for å få" 

But this string is incorrect.

I tried to use "Solving Latin1 and UTF8 errors for good in Ruby", but the problems stayed.

I am using an XML request to send SMS. It uses UTF-8 encoding, but my string is in Norwegian.

Here's part of my string:

Trykk på linken for å få

In SMS I get this:

"Trykk på linken for å få" 

but this string is incorrect.

I tried to use "Solving Latin1 and UTF8 errors for good in Ruby", but the problems stayed.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Denys Medynskyi
  • 2,353
  • 8
  • 39
  • 70
  • I don't understand. Your `a` string is already UTF-8 so why the `force_encoding('iso-8859-1')` call? – mu is too short Jun 22 '13 at 15:53
  • @mu is too short, I meant, that I THINK, that Ruby is doing this. I will edit post. – Denys Medynskyi Jun 22 '13 at 15:56
  • So you're getting `"Trykk pÃ¥ linken for Ã¥ fÃ¥"`, it claims to be UTF-8, and it looks like something is doing a `force_encoding('iso-8859-1').encode('utf-8')` to get from `'Trykk på linken for å få'` to get the final mess of nonsense? You're building the XML using `'Trykk på linken for å få'` and `"Trykk pÃ¥ linken for Ã¥ fÃ¥"` comes out the other side, correct? How does the XML get built and what encoding to the strings think they have at the beginning? – mu is too short Jun 22 '13 at 16:05
  • @muistooshort, I build it using gem. Here is link to file, where header is set - https://github.com/PSWinCom/pswincomgem/blob/master/lib/pswincom/httpsender.rb.. Here is link to class, which is building XML - https://github.com/PSWinCom/pswincomgem/blob/master/lib/pswincom/request.rb. – Denys Medynskyi Jun 22 '13 at 16:10
  • when I run `warn text.encoding.inspect` it gives me `#` – Denys Medynskyi Jun 22 '13 at 16:11
  • PSWinCom service has admin page. When I looked there, I saw, that `Message Type Alphanumeric text` – Denys Medynskyi Jun 22 '13 at 16:17
  • I think you might have to open an issue at github or try debugging the gem yourself to see where it is screwing up the encoding. – mu is too short Jun 22 '13 at 17:38
  • @muistooshort, gem wasn't supported for 2 years. – Denys Medynskyi Jun 24 '13 at 07:50
  • @muistooshort, I found, that in Phyton was similar situation - https://github.com/PSWinCom/pswinpy/pull/2 – Denys Medynskyi Jun 24 '13 at 07:51

0 Answers0