Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8500309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:54:36+00:00 2026-06-11T00:54:36+00:00

in python: >>> \xc4\xe3.decode(gbk).encode(utf-8) ‘\xe4\xbd\xa0′ >>> \xc4\xe3.decode(gbk) u’\u4f60’ we can get two conclusions: 1.\xc4\xe3

  • 0

in python:

>>> "\xc4\xe3".decode("gbk").encode("utf-8")
'\xe4\xbd\xa0'
>>> "\xc4\xe3".decode("gbk")
u'\u4f60'

we can get two conclusions:

1.\xc4\xe3 in gbk encode = \xe4\xbd\xa0 in utf-8
2.\xc4\xe3 in gbk encode = \x4f\x60 in unicode(or say in ucs-2)

in R:

> iconv("\xc4\xe3",from="gbk",to="utf-8",toRaw=TRUE)
[[1]]
[1] e4 bd a0
> iconv("\xc4\xe3",from="gbk",to="unicode",toRaw=TRUE)
[[1]]
[1] ff fe 60 4f

now ,the conclusion1 is correct ,it is as same in python as in R
conclusion2 is a puzzle,
what on earth is the \xc4\xe3 in gbk encode = ?? in unicode.
in python it is u’\u4f60′,in R it is ff fe 60 4f
are the equal? which one is correct?are they all correct?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T00:54:38+00:00Added an answer on June 11, 2026 at 12:54 am

    In python, the \uxxxx notation refers to Unicode codepoints, not to any encoding of those codepoints.

    UCS-2, UTF-16, UTF-8 are all encodings capable of capturing those codepoints in bytes suitable for storage in files, for transferring across a network, etc.

    The R representation of the \u4f60 codepoint includes the UTF-16 Byte Order Mark, or BOM. It indicates what byte order is chosen, where 0xFFFE means little endian. Python includes it too, when you encode to UTF-16:

    >>> u'\uf460'.encode('utf16')
    '\xff\xfe`\xf4'
    

    The big-endian equivalent is 0xFEFF. You can explicitly encode to utf-16be or utf-16le in python to avoid the BOM being included, because you’ve made an explicit choice:

    >>> u'\uf460'.encode('utf-16be')
    '\xf4`'
    >>> u'\uf460'.encode('utf-16le')
    '`\xf4'
    

    You really should read the Joel Spolsky Unicode article, as well as the Python Unicode HOWTO to more fully appreciate the difference between Unicode and encodings.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Python 2 and 3, are the bytecode (pyo & pyc) backward compatible? can i
Python's arbitrary precision decimals are lovely, but I can't seem to find a way
Python (2.6.6 -- EPD 6.3-1 (32-bit)) can not find a binary executable when using
Python works on multiple platforms and can be used for desktop and web applications,
Python's logging functions allow you to pass them multiple arguments that they can interpolate
Python has string.startswith() and string.endswith() functions which are pretty useful. What NSString methods can
Python newbie here. I'm writing a script that can dump some output to either
Python has a json library where you can do json.loads(s) to load json into
Python 3 really complicated the whole file reading process, when you have a binary
(Python) Given two numbers A and B. I need to find all nested groups

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.