Recent

Author Topic: Why Lasarus tries to save PO files in ISO-8859-1 ?  (Read 1745 times)

mm7

  • Full Member
  • ***
  • Posts: 205
  • PDP-11 RSX Pascal, Turbo Pascal, Delphi, Lazarus
Why Lasarus tries to save PO files in ISO-8859-1 ?
« on: August 20, 2024, 03:48:57 am »
When a resourcestring changed, Lasarus merges that into PO files. The PO files should be UTF-8.
But Lazarus shows error messages like the following:

Saving file "/fs02/home/mark/MyProjects/freeship-plus-in-lazarus/locale/FreeShip.cn.po" as "ISO-8859-1" looses characters at line 2851, column 5.

If I click [Cancel] it may leave the file with 0 length.
If I click [Ignore] it saves somewhat UTF-8, but some characters saved in ISO.

It happens when a resourcestring  has a non ISO-8859-1 chars.
Like UTF-8 degree sign °. Instead of writing hex C2 B0, it writes just B0.

I tried to find if non-ISO-8859-1 chars are prohibited in resourcestrings.
I could not find it neither in Lasarus nor in GetText docs.

What to do?

mm7

  • Full Member
  • ***
  • Posts: 205
  • PDP-11 RSX Pascal, Turbo Pascal, Delphi, Lazarus
Re: Why Lasarus tries to save PO files in ISO-8859-1 ?
« Reply #1 on: August 21, 2024, 03:34:23 pm »
I figured this out.
It is weird, though.
The PO files must have following header.

Code: Text  [Select][+][-]
  1. # FreeShip for Lazarus
  2. # Copyright (C) 2024 Free Software Foundation, Inc.
  3. # Author <email>, 2024.
  4. msgid ""
  5. msgstr ""
  6. "Project-Id-Version: \n"
  7. "PO-Revision-Date: 2024-08-15 21:22-0400\n"
  8. "Last-Translator: AUTHOR <email>\n"
  9. "Language-Team: TEAM <email>\n"
  10. "Language: Language\n"
  11. "MIME-Version: 1.0\n"
  12. "Content-Type: text/plain; charset=UTF-8\n"
  13. "Content-Transfer-Encoding: 8bit\n"
  14.  
Not sure which fields are critical, but previously there was just
"Content-Type: text/plain; charset=UTF-8\n"
And it was not enough. Lazarus saved mixed UTF-8 and ISO corrupted files.
« Last Edit: August 21, 2024, 03:37:36 pm by mm7 »

 

TinyPortal © 2005-2018