<FromGitter>
<zblesk:zble.sk> I have a list of strings which contain letters that have diacritics, or chinese characters, things like that. ⏎ Is there anything I could use to convert them to latin-alphabet-only slugs, or safe filenames?
notzmv has joined #crystal-lang
<FromGitter>
<Blacksmoke16> @zblesk:zble.sk for a `content-disposition` header?
<FromGitter>
<Blacksmoke16> be fairly easy to just replace those chars with some other char, but translation to their latin equivalent sounds quite challenging
<FromGitter>
<zblesk:zble.sk> no. I will be using it for various places, like unique URLs or image file names.
<FromGitter>
<zblesk:zble.sk> I could forgo the translation.
<FromGitter>
<zblesk:zble.sk> How would I do that replacement?
<FromGitter>
<Blacksmoke16> `fallback_filename = filename.gsub { |chr| chr.ascii? ? chr : '_' }` is how i handle it
<FromGitter>
<zblesk:zble.sk> but that just deletes anything that isn't ASCII, it looks like?
<FromGitter>
<Blacksmoke16> pretty much yea
<FromGitter>
<zblesk:zble.sk> I would like to at least preserve chars and strip them of diacritics.
<FromGitter>
<zblesk:zble.sk> I know that such a thing can normally be done with Unicode by converting the string into the decomposed form, stripping non-letter codepoints and then composing it again. ⏎ I have checked the String docs, and I currently don't see how I would do that in Crystal.
taupiqueur has quit [Quit: taupiqueur]
<FromGitter>
<Blacksmoke16> hmm
<FromGitter>
<Blacksmoke16> have an example in ruby or another lang?
<FromGitter>
<zblesk:zble.sk> I only did it in dotnet
<FromGitter>
<Blacksmoke16> looks like ruby can do this via `I18n.transliterate` tho idt there is an implementation of that, at least in stdlib ofc
<FromGitter>
<zblesk:zble.sk> ah, thanks
<FromGitter>
<zblesk:zble.sk> I mostly needed this for smaller scripts or apps. Unless someone else has any other idea, I guess I might implement it in dotnet instead.
<FromGitter>
<zblesk:zble.sk> Thank you again for your help!
<FromGitter>
<Blacksmoke16> yea im thinkin we dont have a way to normalize the char
<FromGitter>
<Blacksmoke16> i know Grapheme support is new coming up, but idt thats what you want
<FromGitter>
<zblesk:zble.sk> ah, that seems to be it.
spuun has joined #crystal-lang
sorcus has quit [Quit: WeeChat 3.4]
nq has quit [Ping timeout: 268 seconds]
nq has joined #crystal-lang
sorcus has joined #crystal-lang
renich has joined #crystal-lang
<FromGitter>
<nickwesselman> Hey y'all. 👋 ... new to Crystal but heard about the merge of WASM/WASI support and wanted to take it for a spin. I compiled from master and attempted a hello world... seems like I'm missing something in the `wasm-ld` arguments. There's also a `wasm-ld` command output by the build that doesn't work at all for me. ⏎ ⏎ ```code paste, see link``` [https://gitte