3

I'm using poEdit at work and I'm having trouble with the encoding in po-files.

I have poEdit (version 1.8.8) and a MacBook Pro (version 10.11.4). I'm trying to translate from english to swedish and there are old translations there. But the encoding is wrong so I cannot see the 'ä', 'å' and 'ö' characters.

UPDATED VERSION:

I use github desktop and when I am syncing them files, github desktop likes to write some code in my files. AND I am 100% sure that github desktop does it because the .po-files worked fine before syncing, and there is from no were else I could get this code from.

this is what github desktop writes in my files:

blabla

<<<<<<< HEAD 

"POT-Creation-Date: 2016-07-23 00:13+0000\n"
"PO-Revision-Date: 2016-08-03 17:23+0300\n"

=======

"POT-Creation-Date: 2016-08-11 18:37+0000\n"
"PO-Revision-Date: 2016-08-11 18:37+0000\n"

>>>>>>> origin/master

blabla

Sooo, the <<<<<<< HEAD, ======= and >>>>>>> origin/master?!?!?!?!?!??!?! Why github desktop? And why wont poEdit work with it?

I removed it and everything works fine.

OLD VERSION:

When I open the .po-file with other applications like 'Sublime text 3' or 'textEditor' the encoding is correct (which is UTF-8) and 'ä', 'å' and 'ö' is visible. But if I open the same file with poEdit the encoding will be ISO-8859-1 and this is the output for 'ä','å,'ö':

'ä' => 'ä',

'å' => 'Ã¥',

'ö' => 'ö'.

I have tried changing the encoding in 'Catalog -> Properties -> Charset' but it does not change anything.

My question is: How can I open .po-files with poEdit so the encoding is UTF-8.

OuuGiii
  • 1,053
  • 1
  • 11
  • 31

3 Answers3

5

Poedit seems to have some problem understanding the encoding of files generated with Notepad++, so you can try to add those four lines at the top of the file, before opening it with poedit:

msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"X-Poedit-SourceCharset: UTF-8\n"
T30
  • 11,422
  • 7
  • 53
  • 57
1

Catalog → Properties → Charset does change something: the file's encoding. It doesn't change the content.

Your problem is that you have a broken PO file (not created by Poedit or sane gettext tools) that lies about its encoding. It's not true that the charset is "correct" in Sublime Text, it's that it simply defaults to UTF-8. Your file, which you didn't provide, must lie about its encoding and Poedit trusts it. In other words, the good old Garbage In, Garbage Out principle.

Fix your broken PO's Content-Type header manually in a text editor to be probably(!) UTF-8 and all will be right.

Václav Slavík
  • 6,445
  • 2
  • 28
  • 25
  • It has always been UTF-8, but it is just the strangest thing that I've been using github desktop and while syncing it writes some wierd shit in my code like: <<<<<<< HEAD blabla ======= blabla >>>>>>> origin/master. I erased it and boom, it works. Do you know why github desktop writes that stuff into my code? – OuuGiii Aug 16 '16 at 15:00
0

I solved it, removed what github desktop placed in my code.

This:

blabla

<<<<<<< HEAD 

"POT-Creation-Date: 2016-07-23 00:13+0000\n"
"PO-Revision-Date: 2016-08-03 17:23+0300\n"

=======

"POT-Creation-Date: 2016-08-11 18:37+0000\n"
"PO-Revision-Date: 2016-08-11 18:37+0000\n"

>>>>>>> origin/master

blabla

Becomes this:

blabla    

"POT-Creation-Date: 2016-07-23 00:13+0000\n"
"PO-Revision-Date: 2016-08-03 17:23+0300\n"

blabla

don't need double of POT-Creation-Date and PO-Revision-Date.

OuuGiii
  • 1,053
  • 1
  • 11
  • 31