When practicing the I18n of Java Tutorial. The resourcebundle found to speak in Chinese can't succeed! Is it garbled?
After searching, I finally found the answer. .
Because Java can only process text containing latin-1 and / or uncode-encoded (/ udddd notation) CHARACTERS encoding. So you need to convert the text coding inside. Let's talk about my approach.
Write the .properties file with the text editor (Edit Plus). Save the format of the file as a UTF-8 format. Then convert with Native2ASCII.
Native2ascii -Encoding UTF8 SCR-File path dest-file-path
See below for details.
Native2ASCII - Native-to-Ascii Converter
Native2ASCII - Native-to-Ascii Converter
Converts a file with native-encoded Characters (Characters Which Are Non-Latin 1 and Non-Unicode) To one with uncode-encoded characters.
Synopsis
Native2ASCII [Options] [InputFile "]]
Description
The Java Compiler and Other Java Tools Can Only Process Files Which Contain Latin-1 and / or / or / or / or / or / or / uddddddddddddddddddddddDDDDD
Native2ASCII Converts Files Which Contain Other Character Encodings Into Files Containing Latin-1 And / or Unicode-Encode CHARATERS.
If OUTPUTFILE IS OMITTED, Standard Output IS Used for Output. IF, IN Addition, InputFile IS omitted, Standard INPUT INPUT INPUT INPUT INPUT INPUT.
Options
-reverse
Perform The Reverse Operation: Convert a file with latin-1 and / or uncode encode CHARACTERS To One with native-encoded characters.
-ENCODING Encoding_name
Specify The Encoding Name Which is buy by the conversion procedure. The default encoding is taken from system print
File.Encoding. the
ENCODING_NAME STRING MUST BE Taken from the First Column of the Table of Supported Encodings in The Tackle O
Supported Encodings Document.
-J
Option
PASS
Option to the Java Virtual Machine, Where
Option is one of the options described on the reference page for the reference Page for THE
Java Application Launcher. for example,
-J-XMS48M Sets the Startup Memory to 48 megabytes.