cross-platform way to obtain UTF8 bytes
See original GitHub issueCurrently there is no cross-platform way to convert a String
to a UTF8 byte stream or array. I’ve long thought this was a bit silly, since it’s an easy-enough operation in both Java and JS. We currently have ceylon.buffer.charset
, but that’s JVM-only, and carries a bunch of baggage.
I think this is a reasonable thing to add to the language module, but where should it go:
String
itself?process
orruntime
?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:31 (31 by maintainers)
Top Results From Across the Web
UTF8 support on cross platform C application
How do you find it? Just look for the sequence of bytes; you find it at byte offset 2. This is how strstr...
Read more >How to read utf8 chars/strings from stdin cross-platform?
Now, for reading utf8 I tried reading from stdin byte by byte and checking if the byte indicates a continued utf8 character, but...
Read more >Text Encodings for Cross-Platform Frameworks | Ruminations
My personal recommendation is to use UTF-8, as it has many helpful properties. For starters, ASCII is a subset of UTF-8, so any...
Read more >Unicode and UTF-8 functions
Cross -platform function to test a files access() with a UTF-8 encoded name or value. ... Converts UTF-8 string s to a local...
Read more >UTF-8
UTF-8 is capable of encoding all 1,112,064 valid character code points in Unicode using one to four one-byte (8-bit) code units. Code points...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Honestly, I for one would be perfectly happy leaving this in
ceylon.buffer
.Oh, well now I’m not so sure. There doesn’t seem any way in the
java.nio
stuff to do character-by-character encoding/decoding without allocating aByteBuffer
and aCharacterBuffer
for each character. I suppose that’s just prohibitively slow.