Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Long path with space lead to wrong PO file. #1078

Open
ChameleonRed opened this issue May 5, 2024 · 2 comments · May be fixed by #1120
Open

Long path with space lead to wrong PO file. #1078

ChameleonRed opened this issue May 5, 2024 · 2 comments · May be fixed by #1120

Comments

@ChameleonRed
Copy link

Overview Description

Steps to Reproduce

from io import BytesIO

from babel.messages import Catalog
from babel.messages.pofile import write_po, read_po

output_bytes = BytesIO()

catalog = Catalog()
catalog.add('test', locations=[('x x\\' * 40, 1)])
write_po(output_bytes, catalog, width=0)
data = output_bytes.getvalue()
print(data.decode('utf-8'))

input_bytes = BytesIO(data)
catalog = read_po(input_bytes)
print(catalog.get('test').locations)

Actual Results

Three paths.

Expected Results

One path 'x x\' * 40

Reproducibility

Run code.

Additional Information

I try to replace ' ' with '%20' - it is wrong but it works.

Option with not works as documented.

width=None # wrong type hints
width=-1 # wrap occurs
width= 0 # wrap occurs

Workaround is to replace ' ' or set large width.

@tomasr8
Copy link
Member

tomasr8 commented Jul 25, 2024

For context, xgettext does not wrap location lines, only messages, even when specifying --width=X. We should probably do the same

@akx akx added this to the Babel 2.17 milestone Aug 8, 2024
@akx
Copy link
Member

akx commented Aug 8, 2024

#1105 ties somewhat into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants