Coder Social home page Coder Social logo

Comments (6)

davidfraser avatar davidfraser commented on July 20, 2024

This might or might not be fixed by the latest encoding changes, can you verify
and if not provide a file as a test case…

from translate.

dwaynebailey avatar dwaynebailey commented on July 20, 2024

Tested this using:

pogrep -e “[ḒḓḼḽṄṅṊṋṰṱ]” —errorlevel=traceback ve duh

(All Venda special characters. And it works.

Then again with:

pogrep “ṅ” —errorlevel=traceback ve duh

(n with a dot above)

Everything works correctly

from translate.

dwaynebailey avatar dwaynebailey commented on July 20, 2024

If the files contains no valid PO header and the contents contains non ascii
characters then the grep will fail.

We should fail more gracefully with a warning about the missing header.

from translate.

dwaynebailey avatar dwaynebailey commented on July 20, 2024

Created [attachment 52](http://bugs.locamotion.org/attachment.cgi?id=52)

Small segment of headerless PO file with Unicode chars

[dwayne@laptop-wifi ve]$ pogrep —search=msgstr “ṇ”
—errorlevel=traceback browser-head.po browser-grep.po
processing 1 files…

pogrep: warning: Error processing: input browser-head.po, output
browser-grep.po, template None: Traceback (most recent call last):

File “/usr/lib/python2.4/site-packages/translate/misc/optrecurse.py”, line

418, in recursiveprocess
success = self.processfile(fileprocessor, options, fullinputpath,
fulloutputpath, fulltemplatepath)

File “/usr/lib/python2.4/site-packages/translate/misc/optrecurse.py”, line

471, in processfile
if fileprocessor(inputfile, outputfile, templatefile,
**passthroughoptions):

File “/usr/lib/python2.4/site-packages/translate/tools/pogrep.py”, line 142,

in runpogrep
tofile = checkfilter.filterfile(fromfile)

File “/usr/lib/python2.4/site-packages/translate/tools/pogrep.py”, line 91,

in filterfile
matches = self.filterelement(thepo)

File “/usr/lib/python2.4/site-packages/translate/tools/pogrep.py”, line 84,

in filterelement
if self.matches(unquotedstr): return True

File “/usr/lib/python2.4/site-packages/translate/tools/pogrep.py”, line 56,

in matches
found = teststr.find(self.searchstring) != -1

UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xe1 in position 5: ordinal
not in range(128)

from translate.

dwaynebailey avatar dwaynebailey commented on July 20, 2024

pogrep is now fine – HEAD when we grep for headerless entries in non regexp mode.

However, if you search using —regexp with a Unicode search string then it fails
to detect a matching unicode entry in the Message Unit.

from translate.

dwaynebailey avatar dwaynebailey commented on July 20, 2024

The changes to manage headerless files that Friedel committed (I think) has
fixed this problem.

The encoding of search strings has been manage by forcing a decode from UTF-8.
This will create problems for anyone not using UTF-8. We’ll fix that when teh
problem arrises.

from translate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.