Linux and Windows file garbled problems

Source: Internet
Author: User

<title>Linux and Windows file garbled problems</title> Linux and Windows file garbled problems table of Contents
    • 1. Introduction
    • 2. Iconv detailed
      • 2.1. Iconv–help View Help
      • 2.2. Example 1
    • 3. Dos2unix detailed
      • 3.1. Dos2unix–help View Help
      • 3.2. Example 1
1Brief introduction

Because the Windows system is the current mainstream, for those of us who work under Linux is a bit unfriendly,
Why are you talking like that? Because we often contact Windows under the file, due to the format of the problem will appear garbled Chinese characters!
Fortunately, Linux offers us the command to solve this problem!

2Iconv detailed2.1Iconv–help View Help

Usage: iconv [Options ...] [File ...]
Converts the encoding of a given file.

Input/output format specification:
-f,–from-code= Name Raw text encoding
-t,–to-code= Name Output encoding

Information:
-l,–list enumeration of all known character sets

Output control:
-C ignores invalid characters from output
-o,–output=file output file-s,–silent close warning
–verbose Printing Progress Information

-?, help gives the system Help list
–usage gives a brief usage information
-v,–version Print Program version number

Mandatory or optional parameters for long options are also mandatory or optional for the corresponding short options.

2.2Example 1

Convert demo.c files in GBK format to demoout.c formatted as UTF-8

Iconv-f gbk-t UTF-8 Demo.c-o demo_out.c
3Dos2unix detailed3.1Dos2unix–help View Help3.2Example 1

Files in Linux that convert DOS format to UNIX format can use Dos2unix if a folder has multiple
Files need to be converted using the following command

Find-type F|xargs Dos2unix--dos2unix--safe or Find-type F|xargs dos2unix-o

Author: Wild Book

CREATED:2016-05-11 three 12:55

Emacs 24.5.1 (ORG mode 8.2.10)

Linux and Windows file garbled problems

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.