encode('utf-8') gets error result from u'\ud800' to u'\udfff'
encode('utf-8') gets error result from u'\ud800' to u'\udfff'
UnicodeEncodeError: Unable to translate Unicode character \uD800 at index 0 to
s
pecified code page.
In IronPyhton:
E:\workfolder\ironpythonCompatableFor2.5\25\Lib>ipy
IronPython console: IronPython 2.0A6 (2.0.11102.00) on .NET 2.0.50727.832
Copyright (c) Microsoft Corporation. All rights reserved.
u'\ud800'.encode('utf-8')
Traceback (most recent call last):
File , line 0, in ##237
File mscorlib, line unknown, in GetBytes
File mscorlib, line unknown, in GetBytes
File mscorlib, line unknown, in GetByteCount
File mscorlib, line unknown, in GetByteCount
File mscorlib, line unknown, in InternalFallback
File mscorlib, line unknown, in Fallback
UnicodeEncodeError: Unable to translate Unicode character \uD800 at index 0 to s
pecified code page.
u'\udfff'.encode('utf-8')
Traceback (most recent call last):
File , line 0, in ##245
File mscorlib, line unknown, in GetBytes
File mscorlib, line unknown, in GetBytes
File mscorlib, line unknown, in GetByteCount
File mscorlib, line unknown, in GetByteCount
File mscorlib, line unknown, in InternalFallback
File mscorlib, line unknown, in Fallback
UnicodeEncodeError: Unable to translate Unicode character \uDFFF at index 0 to s
pecified code page.
^Z
In CPython:
E:\workfolder\ironpythonCompatableFor2.5\25\Lib>python
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)]
on
win32
Type ";help";, ";copyright";, ";credits"; or ";license"; for more information.
u'\ud800'.encode('utf-8')
'\xed\xa0\x80'
u'\udfff'.encode('utf-8')
'\xed\xbf\xbf'
Work Item Details
Original CodePlex Issue: Issue 23835 Status: Active Reason Closed: Unassigned Assigned to: Unassigned Reported on: Jul 27, 2009 at 11:59 PM Reported by: dfugate Updated on: Feb 22, 2013 at 2:12 AM Updated by: jdhardy Custom value: Reported internally at Microsoft. Test: test_unicode.py CreatedDate: 11/16/2007 NewInternalID: 409648 OldInternalID: 321875 AreaPath: IronPython\Runtime