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

"flat" charset (ASCII without diacritics) isn't working #54

Open
fhanzlik opened this issue Feb 25, 2024 · 5 comments
Open

"flat" charset (ASCII without diacritics) isn't working #54

fhanzlik opened this issue Feb 25, 2024 · 5 comments

Comments

@fhanzlik
Copy link

fhanzlik commented Feb 25, 2024

What was working in oldier Pinard recode versions is not working now:
`
echo "růžička"|recode -f u8..flat

rika
`
(instead of right result "ruzicka")

@rrthomas
Copy link
Owner

Sorry, indeed flat does not work as before. I'm not sure quite what the answer is; it seems to be complicated.

However, I can offer a workaround in the mean time:

echo "růžička"|recode -f u8..iso-8859-1-translit,iso-8859-1..flat
ruzicka

The second step iso-8859-1..ascii-bs is needed because accented characters that can be represented in ISO-8859-1 will still be present after the first step. So:

echo "érůžička"|recode -f u8..iso-8859-1-translit
�rruzicka

whereas

echo "érůžička"|recode -f u8..iso-8859-1-translit,iso-8859-1..flat
eruzicka

I think the solution to this bug is to make a converter from UTF-8 to ASCII-BS (rather than from Latin-1 to ASCII-BS as at present). This would avoid the need for the -translit step, without adding extra magic. (In Recode 3.6, transliteration is always tried if non-transliterated conversion fails. This means that Recode's behaviour can change according to its input.)

@fhanzlik
Copy link
Author

fhanzlik commented Mar 2, 2024

Hi Thomas, thank for your interest in this issue, and yes - your solution work well!

@rrthomas
Copy link
Owner

rrthomas commented Mar 9, 2024

There is a much easier workaround: use ASCII-translit instead of flat:

echo "érůžička"|recode -f u8..ascii-translit
eruzicka

@fhanzlik
Copy link
Author

Thomas thanks - I'm now using this conversion format.

@rrthomas
Copy link
Owner

I'll keep this open as a placeholder, because something needs to happen with flat; I'm just not sure what yet.

@rrthomas rrthomas reopened this Apr 24, 2024
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

2 participants