3 ms·
What do people do wrong in Java? I wonder if I'm making the same mistake with my Java-based Scheme implementation. I never looked into Unicode deeply.
by brlewis 18y ago
What do people do wrong in Java? I wonder if I'm making the same mistake with my Java-based Scheme implementation. I never looked into Unicode deeply.
- fauigerzigerk 18y agoMost of the time the things that go wrong have little to do with individual languages. The issue with unicode is that you must be consistent across all layers of the application and there is no way to abstract it away in a general fashion. For a Java based scheme implementation the primary issue may be the internal representation of scheme strings. java.lang.String is immutable whereas scheme strings are mutable. It's probably still the cleanest route to stay with some UTF-16 representation internally. Maybe StringBuilder would work but what do you do about regular expressions? I'm glad I don't have to solve that one. You might also want to check out what the jruby guys say about this issue. I think I remember they made the switch from Java Strings to some other mutable representation, I believe UTF-8. They must be using some regex implementation that you might be able to reuse. Also look at SISC. Another issue is the source code character escaping stuff. I don't know what the scheme standard says about this but in any event you have to think about it. The last and easiest thing is to just make sure you always correctly translate back and forth when reading and writing files and network/database connections.