<html><head></head><body>Rust converts to an internal encoding that seems to be a common representation across platforms: WTF-8<br><br><a href="https://simonsapin.github.io/wtf-8/">https://simonsapin.github.io/wtf-8/</a><br><br>That has some odd properties when getting length and trying to split strings. That lead to yet another experiment: OMG-WTF-8<br><br><a href="https://github.com/kennytm/omgwtf8">https://github.com/kennytm/omgwtf8</a><br><br>I'm not sure this is a sensible path. I much prefer the "don't touch the bytes".<br><br><br>Erlang on the other hand seems to try to decode as UTF-8 (or something else you tell it to on startup) and falls back to "raw filenames" if decoding of a filepath fails:<br><br>* <a href="https://www.erlang.org/doc/man/filename.html">https://www.erlang.org/doc/man/filename.html</a><br>* <a href="https://www.erlang.org/doc/apps/stdlib/unicode_usage.html#notes-about-raw-filenames">https://www.erlang.org/doc/apps/stdlib/unicode_usage.html#notes-about-raw-filenames</a><br><br>This wouldn't be too hard to do in Haskell, as something like:<br><br>data OsPath = OsPath { filepath = Maybe String, rawFilepath = ShortByteString }<br><br>But I believe this is questionable API for a low-level library. Libraries building on top of 'filepath' can easily provide such an API.<br><br><br>I'm not sure if there's any language that does the same as AFPP. <br><br><div class="gmail_quote">On July 16, 2022 6:02:39 AM UTC, Magnus Therning <magnus@therning.org> wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre dir="auto" class="k9mail"><br>Julian Ospald <hasufell@posteo.de> writes:<br><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;">Hi,<br><br>this release implements support for the "abstract filepath proposal" (AFPP).<br>There are no breaking changes in the existing API.<br><br>Hackage: <a href="https://hackage.haskell.org/package/filepath-1.4.100.0">https://hackage.haskell.org/package/filepath-1.4.100.0</a><br><br>More information can be found on my blog:<br><a href="https://hasufell.github.io/posts/2022-06-29-fixing-haskell-filepaths.html">https://hasufell.github.io/posts/2022-06-29-fixing-haskell-filepaths.html</a><br></blockquote><br>This is very nice!<br><br>The only other language mentioned is Python. Do you happen to have pointers to how other languages handle this?<br><br>/M<br><br>--<br>Magnus Therning                   OpenPGP: 0x927912051716CE39<br>email: magnus@therning.org<br>@magthe@mastodon.technology       <a href="http://magnus.therning.org/">http://magnus.therning.org/</a><br><br>It is better to keep your mouth shut and appear stupid than to open it<br>and remove all doubt.<br>    — Mark Twain<br></pre></blockquote></div></body></html>