<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>没有比人更高的山 &#187; 编码</title>
	<atom:link href="http://www.zhlwish.com/tag/%e7%bc%96%e7%a0%81/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zhlwish.com</link>
	<description>Where there is a will there is a way.</description>
	<lastBuildDate>Fri, 13 Jan 2012 08:13:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Python从命令行输入中文的编码问题</title>
		<link>http://www.zhlwish.com/2011/03/13/reading_chinese_from_cmd_in_python/</link>
		<comments>http://www.zhlwish.com/2011/03/13/reading_chinese_from_cmd_in_python/#comments</comments>
		<pubDate>Sun, 13 Mar 2011 05:52:37 +0000</pubDate>
		<dc:creator>周亮</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[编码]]></category>

		<guid isPermaLink="false">http://www.zhlwish.com/?p=322</guid>
		<description><![CDATA[写了个python脚本自动完成某项工作，需要将从命令行读入的参数写到utf-8编码的文件中，在linux系统中没有问题，因为shell默认为utf-8编码格式，读入后直接写入就行，但是由于Window系统的默认编码为cp936，始终提示编码有错误 <a href="http://www.zhlwish.com/2011/03/13/reading_chinese_from_cmd_in_python/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
		<wfw:commentRss>http://www.zhlwish.com/2011/03/13/reading_chinese_from_cmd_in_python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python创建特定编码格式的文件</title>
		<link>http://www.zhlwish.com/2010/12/13/python_create_utf8_file/</link>
		<comments>http://www.zhlwish.com/2010/12/13/python_create_utf8_file/#comments</comments>
		<pubDate>Sun, 12 Dec 2010 16:24:01 +0000</pubDate>
		<dc:creator>周亮</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[编码]]></category>

		<guid isPermaLink="false">http://www.zhlwish.com/?p=266</guid>
		<description><![CDATA[话说内置open方法只能创建asiic编码的文件，其函数签名为：open(filename[, mode[, bufsize]])，简单示例如下： 1 2 3 file = open&#40;'dist.txt', 'r'&#41; file.write&#40;'some text'&#41; file.close&#40;&#41; 但是，如果需要创建一个UTF-8编码格式的文件怎么办呢，只能求助于codes模块的open方法了，其签名如下：codecs.open(filename, mode[, encoding[, errors[, buffering]]])，very impressive，示例如下： 1 2 3 file = open&#40;'dist.txt', 'r', 'urf-8'&#41; file.write&#40;u'一些unicode文本'&#41; file.close&#40;&#41; 本文是本博客原创文章，您可以自由转载，但转载请注明来源。]]></description>
		<wfw:commentRss>http://www.zhlwish.com/2010/12/13/python_create_utf8_file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java读取文件的编码问题</title>
		<link>http://www.zhlwish.com/2009/11/15/java-file-encoding/</link>
		<comments>http://www.zhlwish.com/2009/11/15/java-file-encoding/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 00:53:57 +0000</pubDate>
		<dc:creator>周亮</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[编码]]></category>

		<guid isPermaLink="false">http://www.zhlwish.com/?p=29</guid>
		<description><![CDATA[在Java的文件操作中，如果一个文件是UTF-8格式，那么一定要使用UTF-8的编码格式去读取，如果按其他格式读取之后再做转换，可能会发生不可预料的问题，如“乱码”，具体原因我没有搞清楚，因为JDK读取文件时采用了sun.nio.cs.StreamDecoder这个类，这个是sun公司的代码实现，并没有源代码可以参考。 下面就两种方式做记录： 1.Java按一定编码读取文件 InputStream is = Main.class.getResourceAsStream(fileName); BufferedReader br = new BufferedReader(new InputStreamReader(is, "utf-8")); String tmp; while((tmp = br.readLine()) != null){     System.out.println(tmp); } 2.Java字符串编码转换 FileReader reader = new FileReader(fileName); BufferedReader br = new BufferedReader(reader); String tmp; while((tmp = br.readLine()) != &#8230; <a href="http://www.zhlwish.com/2009/11/15/java-file-encoding/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
		<wfw:commentRss>http://www.zhlwish.com/2009/11/15/java-file-encoding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

