Practical application of Python unicode ascii encoding in windows

Source: Internet
Author: User

This document describes how to perform unicode ascii encoding. To solve the problem of Python unicode ascii encoding in windows, * nix. In this actual operation step, if you have any questions about the operation steps, you can browse the following articles.

ASCII is the abbreviation of AmericanStandardCodeforInformationInterchange. It is used to develop the code corresponding to each symbol in the computer. It is also called the code of the computer ). Each ASCII code is stored in 1 Byte. from 0 to 127 represents different common symbols. For example, the ASCII code of uppercase A is 65, and that of lowercase a is 97.

Because the seven ASCII bytes and the highest bit are not used, the highest bit is later incorporated into this set of incode to become the ExtendedASCII code of the Eight-bit, this internal code, coupled with many foreign languages and tables and other special symbols, has become a commonly used internal code.

Python unicode ascii encoding in windows, * nix issues unless your English is good enough or is it related to Chinese, I will definitely use Chinese in python code anyway, code that can run well in windows should not run well in * nix,

The following code

 
 
  1. #! /Usr/bin/env python
  2. # Coding = UTF-8
  3. Rint u "Beijing". encode ("gbk", 'ignore ')

It works well in windows, but not in * nix, because by default, windows programs run the ascii mechanism, and in * nix, for example, I use unicode in ubuntu, therefore, in ubuntu

Print "Beijing"

That's it. It's time to save trouble,

Note: Here Your pythonunicode ascii encoding is UTF-8 in the script file.

I later found some links to related articles, which are only listed here and not verified.

Python Chinese encoding in Linux. _ Tianya blog _ all knowledgeable people are here _ Tianya community

  • It is easy to install Python.
  • Analysis of Python source code
  • For Python beginners
  • Steps for converting url encoding in Python
  • Why mod_python outperforms traditional CGI in terms of performance

I want to use UTF8 encoding in the source code when writing Python programs in Windows. How can this problem be solved?

String and unicode in Python (1)-java_jing logs-Netease blog

Python character encoding conversion _ Grand Theft/Paulau python encoding conversion-this Blog is very powerful-Blog Park Python character encoding conversion tips-hand Chen strategy-BlogJava

[Python learning] Unicode and encoding processing experience-limodou learning history-DonewsBlog

UTF-8 and Unicode FAQ about the conversion of Chinese encoding-PYTHON miscellaneous-away from the rest of the world ......

[Learning] python coding and conversion knowledge-tracking with dreams

In Python, converting any encoded string to Unicode encoding at Python + C = Nuclear or above is an introduction to the actual operation steps of the Python unicode ascii encoding.

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.