New line character encoding problem, jdbc

New line character encoding problem, jdbc

Post by Clau » Tue, 24 Jun 2003 23:13:37



Hi

I have the following problem:

I connect to db2 using the jdbc driver
(COM.ibm.db2.jdbc.app.DB2Driver).
If I write something in a VARCHAR
column and read the data again,
then the new line character ("\n")
is converted to a square sign (on my display, the encoding
is "Latin-1" => "Cp1252"). All other
glyphs are OK (I tested many!). The db runs on Ibm500.

Any suggestions or hints are very
appreciated.

Thanks a lot for your answer in advance !

 
 
 

New line character encoding problem, jdbc

Post by Sherman La » Thu, 26 Jun 2003 03:41:38


That is a major conversion problem with mainframe.  On Host, CCSID 500, the
new line character  is saved as x\15.  Upon retrieve to JDBC,
the characters is converted to U+0085.  On AIX,U+0085 is ignored or
displayed as if there is nothing.  On Windows, U+0085 is displayed as a
square.

Sherman

Quote:> Hi

> I have the following problem:

> I connect to db2 using the jdbc driver
> (COM.ibm.db2.jdbc.app.DB2Driver).
> If I write something in a VARCHAR
> column and read the data again,
> then the new line character ("\n")
> is converted to a square sign (on my display, the encoding
> is "Latin-1" => "Cp1252"). All other
> glyphs are OK (I tested many!). The db runs on Ibm500.

> Any suggestions or hints are very
> appreciated.

> Thanks a lot for your answer in advance !


 
 
 

New line character encoding problem, jdbc

Post by Clau » Thu, 26 Jun 2003 14:56:33


Thanks a lot for your answer.
Is there a way to configure the
jdbc driver so he converts U+00085
to new line ? What workaround do
you recommend (Just replace the
U+0085 to \n in the app, for example)?

Regrards, Claude


> That is a major conversion problem with mainframe.  On Host, CCSID 500, the
> new line character  is saved as x\15.  Upon retrieve to JDBC,
> the characters is converted to U+0085.  On AIX,U+0085 is ignored or
> displayed as if there is nothing.  On Windows, U+0085 is displayed as a
> square.

> Sherman


> > Hi

> > I have the following problem:

> > I connect to db2 using the jdbc driver
> > (COM.ibm.db2.jdbc.app.DB2Driver).
> > If I write something in a VARCHAR
> > column and read the data again,
> > then the new line character ("\n")
> > is converted to a square sign (on my display, the encoding
> > is "Latin-1" => "Cp1252"). All other
> > glyphs are OK (I tested many!). The db runs on Ibm500.

> > Any suggestions or hints are very
> > appreciated.

> > Thanks a lot for your answer in advance !

 
 
 

New line character encoding problem, jdbc

Post by Sherman La » Thu, 26 Jun 2003 23:48:51


U+0085 (newline character) is used on EBCDIC mainframe platform to represent
a new line.  On ASCII platforms like Windows and Unix, U+000A (linefeed
character) is used to represent a new line. I tried to write a simple
program to include U+0015 in a StringBuffer and the compiler does not seem
to like it and complains about invalid character.

Probably what you can do is to parse the string to two separate strings when
you see U+0085. I think JDBC driver is correct. It converts X'15' (new line
character) from EBCDIC 500 to U+0085 (new line character) in Unicode.

Sherman


> Thanks a lot for your answer.
> Is there a way to configure the
> jdbc driver so he converts U+00085
> to new line ? What workaround do
> you recommend (Just replace the
> U+0085 to \n in the app, for example)?

> Regrards, Claude




> > That is a major conversion problem with mainframe.  On Host, CCSID 500,
the
> > new line character  is saved as x\15.  Upon retrieve to JDBC,
> > the characters is converted to U+0085.  On AIX,U+0085 is ignored or
> > displayed as if there is nothing.  On Windows, U+0085 is displayed as a
> > square.

> > Sherman


> > > Hi

> > > I have the following problem:

> > > I connect to db2 using the jdbc driver
> > > (COM.ibm.db2.jdbc.app.DB2Driver).
> > > If I write something in a VARCHAR
> > > column and read the data again,
> > > then the new line character ("\n")
> > > is converted to a square sign (on my display, the encoding
> > > is "Latin-1" => "Cp1252"). All other
> > > glyphs are OK (I tested many!). The db runs on Ibm500.

> > > Any suggestions or hints are very
> > > appreciated.

> > > Thanks a lot for your answer in advance !