<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://try-as400.pocnet.net/index.php?action=history&amp;feed=atom&amp;title=Iconv_conversion_issues_with_CRLF_in_C</id>
	<title>Iconv conversion issues with CRLF in C - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://try-as400.pocnet.net/index.php?action=history&amp;feed=atom&amp;title=Iconv_conversion_issues_with_CRLF_in_C"/>
	<link rel="alternate" type="text/html" href="http://try-as400.pocnet.net/index.php?title=Iconv_conversion_issues_with_CRLF_in_C&amp;action=history"/>
	<updated>2026-04-06T17:50:22Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>http://try-as400.pocnet.net/index.php?title=Iconv_conversion_issues_with_CRLF_in_C&amp;diff=1645&amp;oldid=prev</id>
		<title>PoC: New</title>
		<link rel="alternate" type="text/html" href="http://try-as400.pocnet.net/index.php?title=Iconv_conversion_issues_with_CRLF_in_C&amp;diff=1645&amp;oldid=prev"/>
		<updated>2025-12-30T00:03:23Z</updated>

		<summary type="html">&lt;p&gt;New&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Some network protocols such as http want line ends to be terminated with the traditional MS-DOS/Windows &amp;#039;&amp;#039;&amp;#039;CRLF&amp;#039;&amp;#039;&amp;#039; line wrap. When programming on OS/400 &amp;#039;&amp;#039;&amp;#039;in C&amp;#039;&amp;#039;&amp;#039;, communications to/from the outside world must additionally converted from EBDIC to ASCII and backwards with the standard C library &amp;#039;&amp;#039;&amp;#039;&amp;lt;code&amp;gt;iconv()&amp;lt;/code&amp;gt;&amp;#039;&amp;#039;&amp;#039; function.&lt;br /&gt;
&lt;br /&gt;
Using the default compiler settings in at least V4R5 converts the CR to ASCII &amp;lt;tt&amp;gt;0x0d&amp;lt;/tt&amp;gt; as to be expected, but converts a LF to &amp;lt;tt&amp;gt;0x85&amp;lt;/tt&amp;gt;&amp;lt;ref&amp;gt;The ASCII Next Line (NEL) control character.&amp;lt;/ref&amp;gt; instead of &amp;lt;tt&amp;gt;0x0a&amp;lt;/tt&amp;gt;. Network packet dumps hence show the result as &amp;lt;code&amp;gt;0x0d 0x85&amp;lt;/code&amp;gt;, which is not the expected sequence.&lt;br /&gt;
&lt;br /&gt;
Setting the compiler option &amp;lt;code&amp;gt;sysifcopt(*ifsio)&amp;lt;/code&amp;gt; fixes this behavior.&lt;br /&gt;
&lt;br /&gt;
Excerpt from the &amp;#039;&amp;#039;ILE C Programmer’s Guide&amp;#039;&amp;#039;, Chapter &amp;#039;&amp;#039;Text Streams and Binary Streams&amp;#039;&amp;#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; The &amp;lt;code&amp;gt;*IFSIO&amp;lt;/code&amp;gt; option also changes the value for the &amp;lt;tt&amp;gt;’\n’&amp;lt;/tt&amp;gt; escape character value to the &amp;lt;tt&amp;gt;0x25&amp;lt;/tt&amp;gt; line feed character. If &amp;lt;code&amp;gt;*NOIFSIO&amp;lt;/code&amp;gt; is specified, the &amp;lt;tt&amp;gt;’\n’&amp;lt;/tt&amp;gt; escape character has a value of &amp;lt;tt&amp;gt;0x15&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Weblinks ==&lt;br /&gt;
* [https://comp.sys.ibm.as400.misc.narkive.com/giSN736Z/iconv-fails iconv() fails?], Narkive Newsgroup Archive&lt;br /&gt;
&lt;br /&gt;
== Footnotes ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category: Programming]]&lt;/div&gt;</summary>
		<author><name>PoC</name></author>
	</entry>
</feed>