java - Can we switch between ASCII and Unicode -
i came across "char variable in unicode format, adopts / maps ascii also". need mention that? of course ascii 1 byte , unicode 2. , unicodeitself contains ascii code in (by default - standard). there languages in char
variable supports unicode not ascii?
also, character format (unicode/ascii) decided platform use, right? (unix, linux, windows etc). suppose platform used ascii, not possible switch unicode or vice-versa?
java uses unicode internally. always. actually, uses utf-16 of time, that's detail now.
it can not use ascii internally (for string
example). can represent string can represented in ascii in unicode, should not problem.
the only place platform comes play when java has choose encoding when didn't specify one. example, when create filewriter
write string
values string: @ point java needs use encoding specify how specific character should mapped bytes. if don't specify one, default encoding of platform used. default encoding almost never ascii. linux platforms use utf-8, windows often uses iso-8859-* derivatives (or other culture-specific 8-bit encodings), no current os uses ascii (simply because ascii can't represent lot of important characters).
in fact, pure ascii irrelevant these days: no 1 uses it. ascii only important common subset of mapping of 8-bit encodings (including utf-8): lower 128 unicode codepoints map 1:1 numeric values 0-127 in many, many encodings. pure ascii (where values 128-255 undefined) no longer in active use.
Comments
Post a Comment