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

Wrong conversion of SJIS-encoded text files #74

Open
rikardow opened this issue Jan 25, 2024 · 0 comments
Open

Wrong conversion of SJIS-encoded text files #74

rikardow opened this issue Jan 25, 2024 · 0 comments

Comments

@rikardow
Copy link

rikardow commented Jan 25, 2024

Hi

Thanks for all the good work you do with this plugin

I've been trying to convert text (.txt) files encoded in SJIS and the conversion process doesn't report any problem but the result is incorrect

image

This is because LibreOffice doesn't support the conversion of SJIS files, but it can be solved from the PHP side by converting the contents of the file manually to UTF-8

$formats = ['ASCII', 'JIS', 'UTF-8', 'EUCJP-WIN', 'EUC-JP', 'SJIS-WIN', 'SJIS'];
$enc = mb_detect_encoding($content, $formats);
$utf8_content = mb_convert_encoding($content, 'UTF-8', $enc);

This allows LibreOffice to work as expected

test_sjis_short.txt this is a file encoded in SJIS, for testing purposes

Thanks for your help

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