<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Text Codierung in C++]]></title><description><![CDATA[<p>Hallo!</p>
<p>Bekomme von einem Eingabefeld der GUI (FLTK, Fl_Input) die Umlaute falsch geliefert.<br />
Statt 'Ä' bekomme ich 'Ã' '-'. Ähnlich für andere Umlaute.<br />
Kenn mich bei Text Codierungen nicht so aus, aber ich nehme an es handelt sich um UTF8. Letztlich möchte ich einen ganz normalen std::string damit befüllen.</p>
<p>Hab mir schnell eine Funktion zum Korrigieren eines Textes gebastelt (siehe unten).</p>
<p><strong>Frage: gibts dafür was fertiges in der STL oder bei boost zu finden?</strong></p>
<pre><code>void Umlaute(std::string&amp; txt)
{
	std::string tmp;
	for(size_t i=0;!txt.empty() &amp;&amp; i&lt;txt.size()-1;++i)
	{
		const char curr=txt[i];
		const char next=txt[i+1];

		// Ä
		if(curr==-61 &amp;&amp; next==-124)
		{
			tmp+='Ä';
			++i;
		}

		// ä
		else if(curr==-61 &amp;&amp; next==-92)
		{
			tmp+='ä';
			++i;
		}

		// Ö
		else if(curr==-61 &amp;&amp; next==-106)
		{
			tmp+='Ö';
			++i;
		}
// usw...

	tmp.swap(txt);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/327614/text-codierung-in-c</link><generator>RSS for Node</generator><lastBuildDate>Thu, 09 Jul 2026 10:22:21 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/327614.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 22 Aug 2014 11:33:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Text Codierung in C++ on Fri, 22 Aug 2014 11:33:11 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>Bekomme von einem Eingabefeld der GUI (FLTK, Fl_Input) die Umlaute falsch geliefert.<br />
Statt 'Ä' bekomme ich 'Ã' '-'. Ähnlich für andere Umlaute.<br />
Kenn mich bei Text Codierungen nicht so aus, aber ich nehme an es handelt sich um UTF8. Letztlich möchte ich einen ganz normalen std::string damit befüllen.</p>
<p>Hab mir schnell eine Funktion zum Korrigieren eines Textes gebastelt (siehe unten).</p>
<p><strong>Frage: gibts dafür was fertiges in der STL oder bei boost zu finden?</strong></p>
<pre><code>void Umlaute(std::string&amp; txt)
{
	std::string tmp;
	for(size_t i=0;!txt.empty() &amp;&amp; i&lt;txt.size()-1;++i)
	{
		const char curr=txt[i];
		const char next=txt[i+1];

		// Ä
		if(curr==-61 &amp;&amp; next==-124)
		{
			tmp+='Ä';
			++i;
		}

		// ä
		else if(curr==-61 &amp;&amp; next==-92)
		{
			tmp+='ä';
			++i;
		}

		// Ö
		else if(curr==-61 &amp;&amp; next==-106)
		{
			tmp+='Ö';
			++i;
		}
// usw...

	tmp.swap(txt);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2414582</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2414582</guid><dc:creator><![CDATA[text codierung]]></dc:creator><pubDate>Fri, 22 Aug 2014 11:33:11 GMT</pubDate></item><item><title><![CDATA[Reply to Text Codierung in C++ on Fri, 22 Aug 2014 12:04:44 GMT]]></title><description><![CDATA[<p>Du solltest erstmal in der Referenz der entsprechenden GUI-Lib nachschauen, was die für eine Encodierung liest bzw. rausgibt. Vielleicht kann man dort ja schon wählen.</p>
<p>Und dann gibt es noch sowas wie <a href="http://www.cplusplus.com/reference/cstdlib/mbstowcs/" rel="nofollow">std::mbstowcs</a>, <a href="http://www.cplusplus.com/reference/cstdlib/wcstombs/" rel="nofollow">std::wcstombs</a> und die <a href="http://www.cplusplus.com/reference/codecvt/codecvt_utf8/" rel="nofollow">std::codecvt</a>-Dinger.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2414585</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2414585</guid><dc:creator><![CDATA[Skym0sh0]]></dc:creator><pubDate>Fri, 22 Aug 2014 12:04:44 GMT</pubDate></item><item><title><![CDATA[Reply to Text Codierung in C++ on Mon, 25 Aug 2014 15:29:33 GMT]]></title><description><![CDATA[<p>danke, mit deinen funktionen hat es geklappt.</p>
<p>konkret habe ich dann aber beim gui framework FLTK die passende funktion gefunden:<br />
<strong>fl_utf8toa:</strong> wandelt einen utf8 string in einen ascii string um, so wie man ihn dann auch an einen std::string übergeben kann.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2414874</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2414874</guid><dc:creator><![CDATA[text codierung]]></dc:creator><pubDate>Mon, 25 Aug 2014 15:29:33 GMT</pubDate></item></channel></rss>