<?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: Writing UTF-8 files in C++</title>
	<atom:link href="http://mariusbancila.ro/blog/2008/10/20/writing-utf-8-files-in-c/feed/" rel="self" type="application/rss+xml" />
	<link>http://mariusbancila.ro/blog/2008/10/20/writing-utf-8-files-in-c/</link>
	<description>Sharing my opinions and ideas!</description>
	<lastBuildDate>Tue, 10 Apr 2012 13:37:05 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: hamed ahmad</title>
		<link>http://mariusbancila.ro/blog/2008/10/20/writing-utf-8-files-in-c/comment-page-1/#comment-90724</link>
		<dc:creator>hamed ahmad</dc:creator>
		<pubDate>Mon, 09 Apr 2012 11:54:14 +0000</pubDate>
		<guid isPermaLink="false">http://mariusbancila.ro/blog/?p=135#comment-90724</guid>
		<description>Thanks A Greate example I needed
I got some problems with appendig to wstring but there is allways a work around</description>
		<content:encoded><![CDATA[<p>Thanks A Greate example I needed<br />
I got some problems with appendig to wstring but there is allways a work around</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Staniford</title>
		<link>http://mariusbancila.ro/blog/2008/10/20/writing-utf-8-files-in-c/comment-page-1/#comment-89276</link>
		<dc:creator>Ben Staniford</dc:creator>
		<pubDate>Tue, 27 Mar 2012 16:24:32 +0000</pubDate>
		<guid isPermaLink="false">http://mariusbancila.ro/blog/?p=135#comment-89276</guid>
		<description>Hmm, there&#039;s two things I don&#039;t like about this:

1. Casting away a const and then writing to the underlying buffer is undefined behavior.  As of C++11 you could use &amp;newbuffer[0] which gives you a non-const pointer and is designed for this purpose.

2. Storing utf-8 in the buffer of a string is surely asking for trouble...  What if someone later attemps to use one of strings algorithms on the buffer?  Will it work?  Maybe if the utf-8 characters all happen to be narrow, probably not if there are any wide ones in there.  This is also basically undefined behvior and the only thing you could safely do with that std::string is immediately write it out.</description>
		<content:encoded><![CDATA[<p>Hmm, there&#8217;s two things I don&#8217;t like about this:</p>
<p>1. Casting away a const and then writing to the underlying buffer is undefined behavior.  As of C++11 you could use &amp;newbuffer[0] which gives you a non-const pointer and is designed for this purpose.</p>
<p>2. Storing utf-8 in the buffer of a string is surely asking for trouble&#8230;  What if someone later attemps to use one of strings algorithms on the buffer?  Will it work?  Maybe if the utf-8 characters all happen to be narrow, probably not if there are any wide ones in there.  This is also basically undefined behvior and the only thing you could safely do with that std::string is immediately write it out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: william</title>
		<link>http://mariusbancila.ro/blog/2008/10/20/writing-utf-8-files-in-c/comment-page-1/#comment-83707</link>
		<dc:creator>william</dc:creator>
		<pubDate>Mon, 16 Jan 2012 18:37:11 +0000</pubDate>
		<guid isPermaLink="false">http://mariusbancila.ro/blog/?p=135#comment-83707</guid>
		<description>would be nice to see a linux compatible article</description>
		<content:encoded><![CDATA[<p>would be nice to see a linux compatible article</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: quandaso</title>
		<link>http://mariusbancila.ro/blog/2008/10/20/writing-utf-8-files-in-c/comment-page-1/#comment-81655</link>
		<dc:creator>quandaso</dc:creator>
		<pubDate>Thu, 15 Dec 2011 13:49:36 +0000</pubDate>
		<guid isPermaLink="false">http://mariusbancila.ro/blog/?p=135#comment-81655</guid>
		<description>Thanks, very useful!</description>
		<content:encoded><![CDATA[<p>Thanks, very useful!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Getting started with Unicode &#171; Big O(random)</title>
		<link>http://mariusbancila.ro/blog/2008/10/20/writing-utf-8-files-in-c/comment-page-1/#comment-75421</link>
		<dc:creator>Getting started with Unicode &#171; Big O(random)</dc:creator>
		<pubDate>Tue, 02 Aug 2011 16:17:31 +0000</pubDate>
		<guid isPermaLink="false">http://mariusbancila.ro/blog/?p=135#comment-75421</guid>
		<description>[...] set up some form of automatic conversion that hooks into the C++ streams library. For example, see Writing UTF-8 files in C++ by Marius Bancila. This is information I&#8217;m going to keep in mind, but my testing with GCC 4.5 [...]</description>
		<content:encoded><![CDATA[<p>[...] set up some form of automatic conversion that hooks into the C++ streams library. For example, see Writing UTF-8 files in C++ by Marius Bancila. This is information I&#8217;m going to keep in mind, but my testing with GCC 4.5 [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sam</title>
		<link>http://mariusbancila.ro/blog/2008/10/20/writing-utf-8-files-in-c/comment-page-1/#comment-74889</link>
		<dc:creator>sam</dc:creator>
		<pubDate>Fri, 22 Jul 2011 17:44:01 +0000</pubDate>
		<guid isPermaLink="false">http://mariusbancila.ro/blog/?p=135#comment-74889</guid>
		<description>Hi there,

thanks for the code it&#039;s exactly I was looking for. 
Could you just help me out with one more thing? How can I read utf-8 files?</description>
		<content:encoded><![CDATA[<p>Hi there,</p>
<p>thanks for the code it&#8217;s exactly I was looking for.<br />
Could you just help me out with one more thing? How can I read utf-8 files?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marius Bancila</title>
		<link>http://mariusbancila.ro/blog/2008/10/20/writing-utf-8-files-in-c/comment-page-1/#comment-39972</link>
		<dc:creator>Marius Bancila</dc:creator>
		<pubDate>Sun, 15 Aug 2010 20:28:32 +0000</pubDate>
		<guid isPermaLink="false">http://mariusbancila.ro/blog/?p=135#comment-39972</guid>
		<description>@shahab, sorry this is not a forum where you can ask questions like this. I suggest to bring this problem in a forum like http://www.codeguru.com/forum.</description>
		<content:encoded><![CDATA[<p>@shahab, sorry this is not a forum where you can ask questions like this. I suggest to bring this problem in a forum like <a href="http://www.codeguru.com/forum" rel="nofollow">http://www.codeguru.com/forum</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shahab</title>
		<link>http://mariusbancila.ro/blog/2008/10/20/writing-utf-8-files-in-c/comment-page-1/#comment-39956</link>
		<dc:creator>shahab</dc:creator>
		<pubDate>Sun, 15 Aug 2010 16:59:50 +0000</pubDate>
		<guid isPermaLink="false">http://mariusbancila.ro/blog/?p=135#comment-39956</guid>
		<description>hi,i need a help.pleasssssssse
i want to write a text like:

&quot;i am a student.i&#039;m studing computer science at school.i love programming.i want to be very good in it.&quot;

in a text file.dat or .txt and then read it in c++
in order to find out how many time, say computer word, repaeat in the text
?hjow?</description>
		<content:encoded><![CDATA[<p>hi,i need a help.pleasssssssse<br />
i want to write a text like:</p>
<p>&#8220;i am a student.i&#8217;m studing computer science at school.i love programming.i want to be very good in it.&#8221;</p>
<p>in a text file.dat or .txt and then read it in c++<br />
in order to find out how many time, say computer word, repaeat in the text<br />
?hjow?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Silviu</title>
		<link>http://mariusbancila.ro/blog/2008/10/20/writing-utf-8-files-in-c/comment-page-1/#comment-32844</link>
		<dc:creator>Silviu</dc:creator>
		<pubDate>Fri, 22 Jan 2010 07:53:19 +0000</pubDate>
		<guid isPermaLink="false">http://mariusbancila.ro/blog/?p=135#comment-32844</guid>
		<description>Sorin, if you&#039;re using _wfopen() with css=UTF-8, you automatically add BOM chars to the file beginning. The BOM should create more disadvantages then advantages. 
For instance, if you open again the same file created with the same parameters (just to change your file content) then you must be careful to remove the old BOM chars section, because otherwise you have two BOMs. :D 
I met this situation in the past into a bug of one of my colleges and it isn’t to pretty.
I use std::ofstream class and a class conversion that contains a similarly conversion method, Marius’s sample.</description>
		<content:encoded><![CDATA[<p>Sorin, if you&#8217;re using _wfopen() with css=UTF-8, you automatically add BOM chars to the file beginning. The BOM should create more disadvantages then advantages.<br />
For instance, if you open again the same file created with the same parameters (just to change your file content) then you must be careful to remove the old BOM chars section, because otherwise you have two BOMs. <img src='http://mariusbancila.ro/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /><br />
I met this situation in the past into a bug of one of my colleges and it isn’t to pretty.<br />
I use std::ofstream class and a class conversion that contains a similarly conversion method, Marius’s sample.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Collation, DateTime, SParse Column and XML : Unicode References</title>
		<link>http://mariusbancila.ro/blog/2008/10/20/writing-utf-8-files-in-c/comment-page-1/#comment-27641</link>
		<dc:creator>Collation, DateTime, SParse Column and XML : Unicode References</dc:creator>
		<pubDate>Wed, 20 May 2009 05:01:40 +0000</pubDate>
		<guid isPermaLink="false">http://mariusbancila.ro/blog/?p=135#comment-27641</guid>
		<description>[...] about UTF-8 Encoding. Then he gave a C++ code example of convert from/to UTF-16 to UTF-8. This is another example of writing UTF-8 in [...]</description>
		<content:encoded><![CDATA[<p>[...] about UTF-8 Encoding. Then he gave a C++ code example of convert from/to UTF-16 to UTF-8. This is another example of writing UTF-8 in [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

