<?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[Outputstream Encoding]]></title><description><![CDATA[<p>Hallo Zusammen,</p>
<p>ich habe jetzt leider schon eine halbe Ewigkeit hier im Forum und auf anderen Seiten nach einer Lösung für mein Problem gesucht, bin aber leider noch nicht schlauer geworden. Vielleicht kann mir hier jemand helfen:</p>
<p>Ich möchte eine XML- Datei erstellen, diese soll nach der Erstellung gegen ein Schema geprüft werden.<br />
Das XML-File erstelle ich durch einen ofstream, dort werden die gewünschten Daten in die Datei gestreamt.</p>
<p>Das sieht bisher ungefähr folgendermaßen aus:<br />
_outputFile.imbue(std::locale(&quot;de_DE.UTF-8&quot;));<br />
_outputFile.open( _fileName.c_str() );<br />
...<br />
_outputFile &lt;&lt; Daten in Form von std::strings;</p>
<p>Mein Problem ist nur, das anscheinend die Ausgabe in der Datei nicht in UTF8 vorliegt! Die Datei muss jedoch dieses Encoding besitzen, sonst meckert meine XML-Schema- Datei ein falsches Encoding an.</p>
<p>Kann mir jemand helfen, wie ich die Daten in ein UTF8 gerechtes Format bekomme?</p>
<p>Vielen Dank <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/309147/outputstream-encoding</link><generator>RSS for Node</generator><lastBuildDate>Wed, 05 Aug 2026 12:09:43 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/309147.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 15 Oct 2012 12:54:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Outputstream Encoding on Mon, 15 Oct 2012 12:54:27 GMT]]></title><description><![CDATA[<p>Hallo Zusammen,</p>
<p>ich habe jetzt leider schon eine halbe Ewigkeit hier im Forum und auf anderen Seiten nach einer Lösung für mein Problem gesucht, bin aber leider noch nicht schlauer geworden. Vielleicht kann mir hier jemand helfen:</p>
<p>Ich möchte eine XML- Datei erstellen, diese soll nach der Erstellung gegen ein Schema geprüft werden.<br />
Das XML-File erstelle ich durch einen ofstream, dort werden die gewünschten Daten in die Datei gestreamt.</p>
<p>Das sieht bisher ungefähr folgendermaßen aus:<br />
_outputFile.imbue(std::locale(&quot;de_DE.UTF-8&quot;));<br />
_outputFile.open( _fileName.c_str() );<br />
...<br />
_outputFile &lt;&lt; Daten in Form von std::strings;</p>
<p>Mein Problem ist nur, das anscheinend die Ausgabe in der Datei nicht in UTF8 vorliegt! Die Datei muss jedoch dieses Encoding besitzen, sonst meckert meine XML-Schema- Datei ein falsches Encoding an.</p>
<p>Kann mir jemand helfen, wie ich die Daten in ein UTF8 gerechtes Format bekomme?</p>
<p>Vielen Dank <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2260688</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2260688</guid><dc:creator><![CDATA[sgealexmeier14]]></dc:creator><pubDate>Mon, 15 Oct 2012 12:54:27 GMT</pubDate></item><item><title><![CDATA[Reply to Outputstream Encoding on Mon, 15 Oct 2012 14:29:07 GMT]]></title><description><![CDATA[<p>sgealexmeier14 schrieb:</p>
<blockquote>
<p><code>_outputFile &lt;&lt;</code> Daten in Form von <code>std::strings;</code></p>
</blockquote>
<p>Wide streams ( <code>wostream</code> / <code>std::wofstream</code> ) und wide strings ( <code>std::wstring</code> ) nehmen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2260721</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2260721</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Mon, 15 Oct 2012 14:29:07 GMT</pubDate></item><item><title><![CDATA[Reply to Outputstream Encoding on Mon, 15 Oct 2012 14:31:25 GMT]]></title><description><![CDATA[<p>Da wirst du eine externe Library für benötigen, z.B. <a href="http://www.gnu.org/software/libiconv/" rel="nofollow">libiconv</a>.<br />
In welchem Encoding hältst du denn die Daten (Texte) in deinem Programm?</p>
<p>Aber warum verwendest du denn nicht gleich eine XML-Library, welche Encoding unterstützt? Eine Auswahl von XML-Libraries findest du z.B. unter <a href="http://lars.ruoff.free.fr/xmlcpp" rel="nofollow">http://lars.ruoff.free.fr/xmlcpp</a> oder <a href="http://stackoverflow.com/questions/170686/best-open-xml-parser-for-c" rel="nofollow">http://stackoverflow.com/questions/170686/best-open-xml-parser-for-c</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2260723</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2260723</guid><dc:creator><![CDATA[Th69]]></dc:creator><pubDate>Mon, 15 Oct 2012 14:31:25 GMT</pubDate></item><item><title><![CDATA[Reply to Outputstream Encoding on Mon, 15 Oct 2012 14:51:30 GMT]]></title><description><![CDATA[<p>Danke schon mal für eure Antworten <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /><br />
Die Daten liegen schon in UTF8 vor, die ich in den Outputstream jagen möchte. Von Daher habe ich gedacht, kann ich die Daten gleich mit dem ofstream rausschreiben. Nur ist dann am Ende das Encoding nicht UTF8 sondern ISO-...<br />
Gibt es also auf diesem Wege keine Möglichkeit, ohne wofstream usw., die Dateien in eine UTF-8-Datei zu schreiben?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2260734</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2260734</guid><dc:creator><![CDATA[sgealexmeier14]]></dc:creator><pubDate>Mon, 15 Oct 2012 14:51:30 GMT</pubDate></item><item><title><![CDATA[Reply to Outputstream Encoding on Mon, 15 Oct 2012 17:10:26 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>fehlt evtl. einfach das UTF8-BOM am Anfang der Datei: <a href="http://de.wikipedia.org/wiki/Byte_Order_Mark" rel="nofollow">http://de.wikipedia.org/wiki/Byte_Order_Mark</a> ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2260787</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2260787</guid><dc:creator><![CDATA[Th69]]></dc:creator><pubDate>Mon, 15 Oct 2012 17:10:26 GMT</pubDate></item><item><title><![CDATA[Reply to Outputstream Encoding on Mon, 15 Oct 2012 21:16:31 GMT]]></title><description><![CDATA[<p>Für UTF8 ist eine byte order mark sehr sehr ungewöhnlich, weil sie völlig unnötig ist. So ungewöhnlich, dass man fast davon ausgehen kann, dass die früher oder später zu Problemen führen wird (ich spreche aus leidiger Erfahrung).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2260842</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2260842</guid><dc:creator><![CDATA[Christoph]]></dc:creator><pubDate>Mon, 15 Oct 2012 21:16:31 GMT</pubDate></item><item><title><![CDATA[Reply to Outputstream Encoding on Mon, 15 Oct 2012 21:54:30 GMT]]></title><description><![CDATA[<p>Mal 'ne dumme Frage: Wie stellst du fest, welches Format das Ergebnis hat? Eigentlich sollte das nämlich funktionieren, wenn das Ausgangsmaterial schon UTF-8 ist, selbst (oder gerade) wenn man einfach gar nichts macht. Das schöne an UTF-8 ist ja gerade, dass es selbst für das älteste, dümmste Programm (z.B. ein Compiler oder die C++-Standardlib <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /> ) wie eine Folge von einfachen 8-Bit-Zeichen aussieht. Da müsste schon irgendwo eine aktive Konvertierung stattfinden und ich sehe gerade nicht, wo dies der Fall sein sollte. Außer du machst vielleicht beim Speichern des Quellmaterials schon etwas falsch, so dass dieses gar als UTF-8 vorliegt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2260847</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2260847</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 15 Oct 2012 21:54:30 GMT</pubDate></item><item><title><![CDATA[Reply to Outputstream Encoding on Tue, 16 Oct 2012 06:22:14 GMT]]></title><description><![CDATA[<p>Ich bekomme die Daten aus einer UTF-8 kodierten Postgres-Datenbank.<br />
Daher gehe ich davon aus, dass das Ergebnis auch in UTF-8 vorliegt?!</p>
<p>Das BOM muss ich also nicht unbdedingt setzen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2260873</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2260873</guid><dc:creator><![CDATA[sgealexmeier14]]></dc:creator><pubDate>Tue, 16 Oct 2012 06:22:14 GMT</pubDate></item><item><title><![CDATA[Reply to Outputstream Encoding on Tue, 16 Oct 2012 07:58:41 GMT]]></title><description><![CDATA[<p>sgealexmeier14 schrieb:</p>
<blockquote>
<p>Das BOM muss ich also nicht unbdedingt setzen?</p>
</blockquote>
<p>Genau. Die darfst du bei UTF8 sogar garnicht setzen, außer du willst Probleme heraufbeschwören.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2260886</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2260886</guid><dc:creator><![CDATA[Christoph]]></dc:creator><pubDate>Tue, 16 Oct 2012 07:58:41 GMT</pubDate></item><item><title><![CDATA[Reply to Outputstream Encoding on Tue, 16 Oct 2012 09:11:31 GMT]]></title><description><![CDATA[<p>Ok das ist schon mal gut zu Wissen.</p>
<p>Mein Problem ist leider immer noch nicht gelöst.<br />
Ich habe leider auch zu wenig Erfahrung darin und muss mir das ganze Themengebiet überall zusammensuchen.</p>
<p>Ich habe mal weitere Versuche gemacht, wie z.B. das hier:<br />
&lt;mein ofstream&gt;.imbue (std::locale (std::locale (&quot;de_DE.UTF-8&quot;), new codecvt_byname&lt;wchar_t, char, mbstate_t&gt; (&quot;UTF-8&quot;)));</p>
<p>Die Ausgabedatei erfolgt leider immer noch als ISO-Encoding.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2260907</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2260907</guid><dc:creator><![CDATA[sgealexmeier14]]></dc:creator><pubDate>Tue, 16 Oct 2012 09:11:31 GMT</pubDate></item><item><title><![CDATA[Reply to Outputstream Encoding on Tue, 16 Oct 2012 12:15:02 GMT]]></title><description><![CDATA[<p>Mach einfach gar nix.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2260960</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2260960</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Tue, 16 Oct 2012 12:15:02 GMT</pubDate></item><item><title><![CDATA[Reply to Outputstream Encoding on Tue, 16 Oct 2012 12:29:35 GMT]]></title><description><![CDATA[<p>wie meinst du das?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2260965</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2260965</guid><dc:creator><![CDATA[sgealexmeier14]]></dc:creator><pubDate>Tue, 16 Oct 2012 12:29:35 GMT</pubDate></item><item><title><![CDATA[Reply to Outputstream Encoding on Tue, 16 Oct 2012 12:49:04 GMT]]></title><description><![CDATA[<p>sgealexmeier14 schrieb:</p>
<blockquote>
<p>wie meinst du das?</p>
</blockquote>
<p>Leite die Eingabe einfach durch, ohne irgendwelche locales oder so.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2260977</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2260977</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Tue, 16 Oct 2012 12:49:04 GMT</pubDate></item><item><title><![CDATA[Reply to Outputstream Encoding on Tue, 16 Oct 2012 12:50:44 GMT]]></title><description><![CDATA[<p>Aber dann ist es ja auch ISO und nicht UTF8 <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2260979</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2260979</guid><dc:creator><![CDATA[sgealexmeier14]]></dc:creator><pubDate>Tue, 16 Oct 2012 12:50:44 GMT</pubDate></item><item><title><![CDATA[Reply to Outputstream Encoding on Tue, 16 Oct 2012 14:16:38 GMT]]></title><description><![CDATA[<p>sgealexmeier14 schrieb:</p>
<blockquote>
<p>Aber dann ist es ja auch ISO und nicht UTF8 <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
</blockquote>
<p>Edit: Ich konnte es endlich lösen. Ich habe überall rumgesucht, nur nicht da, wo ich mir eigentlich sicher war, das es passt. Wie ihr schon mal gesagt hattet, lagen meine Daten nicht in UTF8 vor. Ich musste obwohl es eine UTF8-DB war, das Encoding ändern, da Standardmäßig ISO verwendet wird.</p>
<p>Es tut mir leid, dass Ihr mir wegen sowas helfen musstet. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /><br />
Aber ich bedanke mich bei der schnellen Hilfe!</p>
<p>Vielen Dank und Viele Grüße</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2261033</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2261033</guid><dc:creator><![CDATA[sgealexmeier14]]></dc:creator><pubDate>Tue, 16 Oct 2012 14:16:38 GMT</pubDate></item></channel></rss>