bugGNU gettext - Bugs: bug #19917, xgettext fails when python code...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #19917: xgettext fails when python code contains unmarked string with invalid hexadecimal escapes

Submitted by:  None
Submitted on:  Mon 21 May 2007 06:49:28 AM UTC  
 
Category: PythonSeverity: 3 - Normal
Item Group: NoneStatus: Wont Fix
Privacy: PublicAssigned to: Bruno Haible <haible>
Open/Closed: Closed

Wed 29 Aug 2007 10:38:15 PM UTC, comment #1:

I can reproduce the error message.

The input file is in error: It specifies that it is encoded in
EUC-KR (according to PEP 0263 convention). In Python, \x escape
sequences inside strings are interpreted in the source encoding.
But the escape sequence of variable 'a' is not valid EUC-KR:

$ printf '\xe8\xaa\x9e\xe8\xa8\x80\n' | iconv -f EUC-KR
iconv: (stdin):1:0: cannot convert

In theory, xgettext could store the parsed strings in raw form,
as they occur in the input file, up until the moment where it
needs to put them into the .pot file. Why does it choose to
convert them to Unicode immediately? Because in Python, these
strings can contain a mix between \x and \u sequences:
"abc\xe8\xaa\x9e\u20ac". This is unlike all most programming
languages. Doing the conversion early means that the xgettext
backends can share the code for processing strings (e.g.
the function arglist_parser_remember). I'm not eager to have
different string types for C strings, Java strings, and Python
strings inside xgettext.

Bruno Haible <haible>
Project AdministratorIn charge of this item.
Mon 21 May 2007 06:49:28 AM UTC, original submission:

I attached a python source code, and When I trying to extract translatable strings from this code, xgettext failed.

<pre>
$ xgettext --default-domain=hello --add-comments=TRANSLATOR --keyword=_ --keyword=N_ hello.py
xgettext: hello.py: input is not valid in "EUC-KR" encoding
</pre>

Value a and b are just non-translatable string, but xgettext is trying to convert.

Anonymous

 

Attached Files
file #12814:  hello.py added by None (130B - text/x-python - A Sample python code for error case)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by haible (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 26 Nov 2016 11:44:59 PM UTChaibleCategoryNone=>Python
    Sun 30 Sep 2007 11:25:27 PM UTChaibleOpen/ClosedOpen=>Closed
    Sun 02 Sep 2007 04:31:22 PM UTChaibleSummaryxgettext trying to extract normal string from python code and failed.=>xgettext fails when python code contains unmarked string with invalid hexadecimal escapes
    Wed 29 Aug 2007 10:38:15 PM UTChaibleStatusNone=>Wont Fix
      Assigned toNone=>haible
    Mon 21 May 2007 06:49:28 AM UTCNoneAttached File-=>Added hello.py, #12814

    Back to the top


    Powered by Savane 3.1-cleanup1