<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Notes for using Unicode with Python 2.x</title>
	<atom:link href="http://ginstrom.com/scribbles/2008/11/16/notes-for-using-unicode-with-python-2x/feed/" rel="self" type="application/rss+xml" />
	<link>http://ginstrom.com/scribbles/2008/11/16/notes-for-using-unicode-with-python-2x/</link>
	<description>Random scribbling about programming, translation, and Japan</description>
	<lastBuildDate>Thu, 10 May 2012 05:41:14 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Ali</title>
		<link>http://ginstrom.com/scribbles/2008/11/16/notes-for-using-unicode-with-python-2x/comment-page-1/#comment-417</link>
		<dc:creator>Ali</dc:creator>
		<pubDate>Tue, 16 Dec 2008 09:33:05 +0000</pubDate>
		<guid isPermaLink="false">http://ginstrom.com/scribbles/?p=575#comment-417</guid>
		<description>I want to learn python 3.0 because it asserts that all characters in unicode (UTF8) but I could not understand the stuation.
Could you explain what did I wrong?

I am using Windows XP professional version 2002 Service pack 3. AMD Athlon(TM)XP 2400+ 2.00GHz 992MB RAM.

I have downloaded Windows x86 MSI Instaler Python 3.0 (sig) (r30:67507, Dec  3 2008, 20:14:27) [MSC v.1500 32 bit (Intel)] on win32

Control Panel -&gt; System -&gt; Advanced -&gt; Environment Variables.
System Variables -&gt; Path -&gt; edit C:\Windows\System32\Wbem;C:\Python30

start -&gt; programs -&gt; python 3.0 -&gt; IDLE(Python GUI)

-&gt; IDLE 3.0 -&gt; File -&gt; New Window -&gt; i wrote &quot;print(&#039;ğüşçöı&#039;)&quot; without qutes
-&gt; File -&gt; Save -&gt; Python30 -&gt; i gave file name &quot;d2.py&quot; without qutes
-&gt; and Run -&gt; Run Module -&gt; it gives error &quot;invalid character in identifier&quot;

then i tried second method

start -&gt; run -&gt; cmd -&gt; d2.py and enter it gives the error


C:\&gt;d2.py
Traceback (most recent call last):
  File &quot;C:\Python30\d2.py&quot;, line 4, in
    print(&#039;\u011fü\u015fçö\u0131&#039;)
  File &quot;C:\Python30\lib\io.py&quot;, line 1491, in write
    b = encoder.encode(s)
  File &quot;C:\Python30\lib\encodings\cp437.py&quot;, line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: &#039;charmap&#039; codec can&#039;t encode character &#039;\u011f&#039; in position
0: character maps to

C:\&gt;

But if i write in Phyton Shell -&gt; &gt;&gt;&gt; print(&#039;ğüşçöı&#039;) and pressed enter
-&gt; gives &#039;ğüşçöı&#039; it works.

and I tried below characters in Phyton Shell -&gt; &gt;&gt;&gt; print(&#039;?????????)
but if I firstli write in notepad and copied pasted it works
print(&#039;ḍḥḫṣṭẕāīū&#039;)

What is wrong?</description>
		<content:encoded><![CDATA[<p>I want to learn python 3.0 because it asserts that all characters in unicode (UTF8) but I could not understand the stuation.<br />
Could you explain what did I wrong?</p>
<p>I am using Windows XP professional version 2002 Service pack 3. AMD Athlon(TM)XP 2400+ 2.00GHz 992MB RAM.</p>
<p>I have downloaded Windows x86 MSI Instaler Python 3.0 (sig) (r30:67507, Dec  3 2008, 20:14:27) [MSC v.1500 32 bit (Intel)] on win32</p>
<p>Control Panel -&gt; System -&gt; Advanced -&gt; Environment Variables.<br />
System Variables -&gt; Path -&gt; edit C:\Windows\System32\Wbem;C:\Python30</p>
<p>start -&gt; programs -&gt; python 3.0 -&gt; IDLE(Python GUI)</p>
<p>-&gt; IDLE 3.0 -&gt; File -&gt; New Window -&gt; i wrote &#8220;print(&#8216;ğüşçöı&#8217;)&#8221; without qutes<br />
-&gt; File -&gt; Save -&gt; Python30 -&gt; i gave file name &#8220;d2.py&#8221; without qutes<br />
-&gt; and Run -&gt; Run Module -&gt; it gives error &#8220;invalid character in identifier&#8221;</p>
<p>then i tried second method</p>
<p>start -&gt; run -&gt; cmd -&gt; d2.py and enter it gives the error</p>
<p>C:\&gt;d2.py<br />
Traceback (most recent call last):<br />
  File &#8220;C:\Python30\d2.py&#8221;, line 4, in<br />
    print(&#8216;\u011fü\u015fçö\u0131&#8242;)<br />
  File &#8220;C:\Python30\lib\io.py&#8221;, line 1491, in write<br />
    b = encoder.encode(s)<br />
  File &#8220;C:\Python30\lib\encodings\cp437.py&#8221;, line 19, in encode<br />
    return codecs.charmap_encode(input,self.errors,encoding_map)[0]<br />
UnicodeEncodeError: &#8216;charmap&#8217; codec can&#8217;t encode character &#8216;\u011f&#8217; in position<br />
0: character maps to</p>
<p>C:\&gt;</p>
<p>But if i write in Phyton Shell -&gt; &gt;&gt;&gt; print(&#8216;ğüşçöı&#8217;) and pressed enter<br />
-&gt; gives &#8216;ğüşçöı&#8217; it works.</p>
<p>and I tried below characters in Phyton Shell -&gt; &gt;&gt;&gt; print(&#8216;?????????)<br />
but if I firstli write in notepad and copied pasted it works<br />
print(&#8216;ḍḥḫṣṭẕāīū&#8217;)</p>
<p>What is wrong?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Ginstrom</title>
		<link>http://ginstrom.com/scribbles/2008/11/16/notes-for-using-unicode-with-python-2x/comment-page-1/#comment-420</link>
		<dc:creator>Ryan Ginstrom</dc:creator>
		<pubDate>Sun, 16 Nov 2008 01:11:41 +0000</pubDate>
		<guid isPermaLink="false">http://ginstrom.com/scribbles/?p=575#comment-420</guid>
		<description>@empii

I didn&#039;t know that -- thanks for pointing it out!

@Jack

Also good to know. In the only C extensions I&#039;ve written, I just required that all strings be passed in as Unicode. &quot;et&quot; is an elegant alternative.</description>
		<content:encoded><![CDATA[<p>@empii</p>
<p>I didn&#8217;t know that &#8212; thanks for pointing it out!</p>
<p>@Jack</p>
<p>Also good to know. In the only C extensions I&#8217;ve written, I just required that all strings be passed in as Unicode. &#8220;et&#8221; is an elegant alternative.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jack Miller</title>
		<link>http://ginstrom.com/scribbles/2008/11/16/notes-for-using-unicode-with-python-2x/comment-page-1/#comment-419</link>
		<dc:creator>Jack Miller</dc:creator>
		<pubDate>Sat, 15 Nov 2008 20:06:54 +0000</pubDate>
		<guid isPermaLink="false">http://ginstrom.com/scribbles/?p=575#comment-419</guid>
		<description>Good content.

I also think it&#039;s worth noting that, if you have any C extensions you&#039;re writing you can use the &quot;et&quot; format arguments in your PyArg_ParseTuple (or equivalent) to keep Python from attempting to encode everything you pass to it to ascii.

This also means that you have to PyMem_Free all of the strings you get, however.</description>
		<content:encoded><![CDATA[<p>Good content.</p>
<p>I also think it&#8217;s worth noting that, if you have any C extensions you&#8217;re writing you can use the &#8220;et&#8221; format arguments in your PyArg_ParseTuple (or equivalent) to keep Python from attempting to encode everything you pass to it to ascii.</p>
<p>This also means that you have to PyMem_Free all of the strings you get, however.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: empii</title>
		<link>http://ginstrom.com/scribbles/2008/11/16/notes-for-using-unicode-with-python-2x/comment-page-1/#comment-418</link>
		<dc:creator>empii</dc:creator>
		<pubDate>Sat, 15 Nov 2008 19:40:21 +0000</pubDate>
		<guid isPermaLink="false">http://ginstrom.com/scribbles/?p=575#comment-418</guid>
		<description>When converting utf-8 bytes to unicode you can use the encoding utf_8_sig instead of utf-8 (on python &gt;= 2.5). utf_8_sig skips the leading UTF-8 encoded BOM if it&#039;s there. This nicely hides the second twist in your codecs.open example.</description>
		<content:encoded><![CDATA[<p>When converting utf-8 bytes to unicode you can use the encoding utf_8_sig instead of utf-8 (on python &gt;= 2.5). utf_8_sig skips the leading UTF-8 encoded BOM if it&#8217;s there. This nicely hides the second twist in your codecs.open example.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

