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

PO Export doesn't seem to escape properly #6238

Open
darthsteven opened this issue Feb 21, 2025 · 1 comment
Open

PO Export doesn't seem to escape properly #6238

darthsteven opened this issue Feb 21, 2025 · 1 comment

Comments

@darthsteven
Copy link

Describe the bug
When using drush locale:export strings containing \ are not escaped fully.

To Reproduce
See: https://www.drupal.org/project/views_data_export/issues/3222763

drush locale:export en | msguniq -

Expected behavior
When exporting the string:

t('Indicates the character used for escaping. Defaults to a backslash (<code>\</code>).');

It should be exported as:

msgid ""
"Indicates the character used for escaping. Defaults to a backslash "
"(<code>\\</code>)."

Actual behavior
It is exported as:

msgid ""
"Indicates the character used for escaping. Defaults to a backslash "
"(<code>\</code>)."

Workaround
Not sure who's responsibility to escape the string is? The write component is in core!

System Configuration

Q A
Drush version? Drush Commandline Tool 13.3.3.0
Drupal version? 10.4
PHP version 8.2
OS? Linux

Additional information
See: https://www.drupal.org/project/views_data_export/issues/3222763

@darthsteven
Copy link
Author

Okay, it's because of this line:

$this->output()->writeln(file_get_contents($file_uri));

This will mean that the output goes through a formatter, and changes the \\ to a \. Crazy!

Simple solution though:

$this->output()->writeln(file_get_contents($file_uri), OutputInterface::OUTPUT_RAW);

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

No branches or pull requests

1 participant