The Code has been frequently debugged in windows and ubuntu over the past few days. Different character encoding formats have always caused great troubles. The default character encoding format in windows is GBK (gb2312) in ubuntu, UTF-8 is used. It took a lot of effort to save the encoding format back and forth the day before. Today, google found a temporary solution, which is a good method.
Ubuntu comes with a character encoding format Adjustment Command: iconv
ICONV (1) Debian GNU/Linux ICONV (1)
NAME
Iconv-Convert encoding of given files from one encoding to another
SYNOPSIS
Iconv-f encoding [-t encoding] [inputfile]...
DESCRIPTION
The iconv program converts the encoding of characters in inputfile, or
From the standard input if no filename is specified, from one coded
Character set to another. The result is written to standard output
Unless otherwise specified by the -- output option.
-- From-code,-f encoding
Convert characters from encoding.
-- To-code,-t encoding
Convert characters to encoding. If not specified the encoding
Corresponding to the current locale is used.
-- List,-l
List known coded character sets.
-C Omit invalid characters from output.
-- Output,-o file
Specify output file (instead of stdout ).
-- Silent,-s
Suppress warnings, but not errors.
-- Verbose
Print progress information.
-- Help ,-?
Give help list.
-- Usage
Give a short usage message.
-- Version,-V
Print program version.
ENCODINGS
The values permitted for -- from-code and -- to-code can be listed by
Iconv -- list command, and all combinations of the listed values are
Supported. Furthermore the following two suffixes are supported:
// Transcoder
When the string "// Transcoder" is appended to -- to-code,
Transliteration is activated. This means that when a character
Cannot be represented in the target character set, it can be
Approximated through one or several similarly looking
Characters.
// IGNORE
When the string "// IGNORE" is appended to -- to-code, characters
That cannot be represented in the target character set will be
Silently discarded.
AUTHOR
Iconv was written by Ulrich Drepper as part of the gnu c Library.
This man page was written by Joel Klecker <espy@debian.org>, for
Debian GNU/Linux system.
3rd Berkeley Distribution lenny ICONV (1)
It is estimated that you will be able to understand it through the above introduction.
Iconv-f gb2312-t UTF-8 a.txt> B .txt;
You can convert a.txt, a file named gb2312', to a B .txt file in the format of 8th. In this way, you can view it normally in ubuntu. I hope this will help you and keep your backup.
From the timebomb Column