Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Originally posted by Edwin Dalorzo:
One way to do it would be:
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
A String represents a string in the UTF-16 format ...
Sorry, but this is all totally incorrect. Peter is right, all Java Strings are sequences of chars, and all Java chars are Unicode code-points in UTF-16. (Before Unicode 4.0 it was simpler, a char was just a Unicode character.)Originally posted by Edwin Dalorzo:
Hi, Peter.
You continue to say that Java String are always in UTF-16. Why do you say that?
The encoding of the Java Strings is determined by the default encoding used by the JVM, declared in the file.encoding property.
Another thing very different is the encoding of the Java files (*.java) which might be UTF. But doest not have anything to do with you your application.
Strings are encoded according to every particular environment and you can just as easily convert a string from one encoding to the other. The String class provides methods for such purposes as well as java.nio.charset package.
So, Peter, how come you say all String in Java are UTF-16?
The example that I wrote is a way to convert a String from whatever format it is into ASCII format. I assumed tha format is UTF-X, not implying by this that is always the case.
Another option to convert a String from one enconding to another is the use of java.nio.charset package by means of using the Encoder and Decoder classes.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |