December 19, 2016 Re: proposal string std.utf:sanitizeUTF(string) which returns an always valid UTF8 string | ||||
---|---|---|---|---|
| ||||
On Sunday, December 18, 2016 18:29:16 Timothee Cour via Digitalmars-d wrote: > I keep running into issues due to auto-decoding (arguably a significant > design flaw of phobos) when using strings from external sources (which may > not be 100% valid UTF8) eg see stracktrace [1] on > getSomeExternalString().splitLines, > > Could we have something like `sanitizeUTF` in std.utf, to allow for a > simple fix when running into such UTF8 issues see proposal implementation > [2]; the fix would then be: > ``` > getSomeExternalString().splitLines, > => > getSomeExternalString().sanitizeUTF.splitLines, > ``` Use std.utf.byUTF: http://dlang.org/phobos/std_utf.html#byUTF - Jonathan M Davis |
Copyright © 1999-2021 by the D Language Foundation