Earlier quoted context omitted.
Randomly truncating words can have the same effect in any language. It's outright trivial to find examples in English or German. I don't understand why one has to invoke Arab script for a good example.
Yes, but you don’t end up with different glyphs. Arabic script has letter shaping, that means a letter can have up to 4 shapes based on its position within the word. If you chop off the last letter, the previous one which used to have a “middle” position shape suddenly changes into “terminal” position shape.
How to chop off bytes of an UTF-8 string to fit into a small slot and look nice
61–66 of 66 posts
Re: How to chop off bytes of an UTF-8 string to fit into a small slot and look nice
#62Earlier quoted context omitted.
No need to go to the kernel API to create filenames that are invalid UTF-16. The Win32 API will happily let you do it.
I was AFK so couldn't check, but yeah you're right. Just made two files named ä.txt which happily sat next to each other, one being NFC and other NFD. So yeah, don't mess with the normalization of filenames.
Äh, nu går vi och gör något annat.
Re: How to chop off bytes of an UTF-8 string to fit into a small slot and look nice
#63Better use grapheme clusters than Unicode characters. After all, you don't want to chop the diaeresis off an ë.
Re: How to chop off bytes of an UTF-8 string to fit into a small slot and look nice
#64Earlier quoted context omitted.
Yes, but you don’t end up with different glyphs. Arabic script has letter shaping, that means a letter can have up to 4 shapes based on its position within the word. If you chop off the last letter, the previous one which used to have a “middle” position shape suddenly changes into “terminal” position shape.
I'm thinking even bog-standard European umlauts, cedillas, etc go multi-byte in Unicode? (Take a string of ÅÄÖåäöÜü and chop it off at various byte limits and see.)
Re: How to chop off bytes of an UTF-8 string to fit into a small slot and look nice
#65Earlier quoted context omitted.
Yes, but you don’t end up with different glyphs. Arabic script has letter shaping, that means a letter can have up to 4 shapes based on its position within the word. If you chop off the last letter, the previous one which used to have a “middle” position shape suddenly changes into “terminal” position shape.
I'm thinking even bog-standard European umlauts, cedillas, etc go multi-byte in Unicode? (Take a string of ÅÄÖåäöÜü and chop it off at various byte limits and see.)
Re: How to chop off bytes of an UTF-8 string to fit into a small slot and look nice
#66Earlier quoted context omitted.
I was AFK so couldn't check, but yeah you're right. Just made two files named ä.txt which happily sat next to each other, one being NFC and other NFD. So yeah, don't mess with the normalization of filenames.
But ä.txt is a perfectly normal filename! WTF is there to "normalize" about that?!? Äh, nu går vi och gör något annat.
Win32/NTFS treats them as two different filenames, as it doesn't normalize them before storing/comparing.