vslavik / poedit

Translations editor for Mac, Windows and Unix
https://poedit.net
MIT License
1.77k stars 275 forks source link

Incorrect handling of '\a' #730

Closed cloudfish closed 2 years ago

cloudfish commented 2 years ago

Poedit 3.0.1 does not correctly handle the escape sequence '\a'. Steps to illustrate it:

  1. Save the following as a .po file
    
    msgid ""
    msgstr ""
    "Project-Id-Version: \n"
    "POT-Creation-Date: \n"
    "PO-Revision-Date: \n"
    "Last-Translator: Someone <someone@example.com>\n"
    "Language-Team: \n"
    "Language: zh_CN\n"
    "MIME-Version: 1.0\n"
    "Content-Type: text/plain; charset=UTF-8\n"
    "Content-Transfer-Encoding: 8bit\n"
    "Plural-Forms: nplurals=1; plural=0;\n"
    "X-Generator: Poedit 3.0.1\n"

msgid "\a" msgstr ""


2. Open the file with poedit. The source text is shown as '\a'. Input '\a' in the translated text box, and save the file. You will find that the translated text is '\007' in the upper part of the window. This is inconsistent with the way poedit displays source text. And if you open the saved file with a text editor, the msgstr will be "\a" (should be "\\\\a").
3. If you input '\\\\a' in the translated text box, and save the file, the resulting msgstr will be correct (same as msgid), but if you reopen the file with poedit, the translated text will be shown as '\a' again, and if you append something to the translated text and save the file, you will get a "\a" in msgstr again.
vslavik commented 2 years ago

What is "upper part of the window"?

What is "correct result" in your view and why do you think showing as '\a' is wrong (when you previously complained about not being that)?

cloudfish commented 2 years ago

What is "upper part of the window"?

The part that shows a summary of the strings, one string per line.

What is "correct result" in your view and why do you think showing as '\a' is wrong (when you previously complained about not being that)?

I edited the original post to add missed markdown escapes. Maybe there was some misunderstanding caused by it, so please re-read the original post, sorry :-)

The correct result in my view is, if you input '\a' in the translated text and save the file, the text shown in poedit should be '\a', but the msgstr should be "\\a" in a plain text editor. Both results are to be consistent with the way poedit displays the source text "\\a".

And if you input "\\a" in the translated text and save and re-open the file, the translated text shown should still be "\\a", of course.