Three kinds js file in eclipse occurs Chinese garbled solution

Here the record about Eclipse open / edit the JS file, solutions Chinese garbled.

The reason Chinese garbled

In Eclipse, the default encoding js file is ISO-8859-1, this encoding and Chinese are not compatible, leading to decoding failure was followed by a Chinese garbled.

The solution Chinese garbled

The solution is to modify the encoding of the js file corresponding Chinese encoding it.

1. Click Windows-> Preferences-> General-> Content Types-> Text-> JavaScript Source File, encoding format will be changed to UTF-8.

2. When introduced js file specified character set encoding, the form: <script type = "text / javascript" src = "yanggb.js" charset = "utf-8"> </ script>.

3. Eclipse workspace coding into UTF-8: Windows-> Preferences-> Workspace-> Text file encoding, change to UTF-8.

Examples cited above are encoded in UTF-8, if desired other Chinese encoding, such as GBK, arranged according to kind.

 

"This barren desert, then you come to this Zouliaoyizao, miraculous things grow, here it is the opposite of my heart .-- read it cut to the heart."

Guess you like

Origin www.cnblogs.com/yanggb/p/12106379.html