By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,586 Members | 2,418 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,586 IT Pros & Developers. It's quick & easy.

PROBLEM WITH JUNK CHARECTER

P: n/a
Hello all,
i have a column in a table which stores tag lines which are usually
less than 500 charecter. when we display the data through the
browser some character display as "boxes" or junks. i predict it may
be the newline or carriage return character.
is there any function so that i can ward of these characters

my database is under utf 8
and my db2level is

DB21085I Instance "DB2" uses "32" bits and DB2 code release
"SQL08020" with
level identifier "03010106".
Informational tokens are "DB2 v8.1.7.445", "s040812", "WR21342", and
FixPak
"7".
Thanks
sri

Apr 2 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
situ wrote:
Hello all,
i have a column in a table which stores tag lines which are usually
less than 500 charecter. when we display the data through the
browser some character display as "boxes" or junks. i predict it may
be the newline or carriage return character.
is there any function so that i can ward of these characters
I see a few possible sources for this:
(1) The character set of your browser doesn't understand the characters you
give it. Switching the character set may resolve the issue.
(2) You store crappy data in DB2 because your data source provides incorrect
data.
(3) Your application retrieves correct data from DB2 but garbles it up.

You should figure out what is going on and what the desired behavior should
be. Right now you don't know exactly which characters are not shown
correctly.

As for preventing certain characters, you can write triggers that either
transform the data (see TRANSFORM function) or reject it (see SIGNAL
statement).

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Apr 2 '07 #2

P: n/a
On Apr 2, 9:04 pm, Knut Stolze <sto...@de.ibm.comwrote:
situ wrote:
Hello all,
i have a column in a table which stores tag lines which are usually
less than 500 charecter. when we display the data through the
browser some character display as "boxes" or junks. i predict it may
be the newline or carriage return character.
is there any function so that i can ward of these characters

I see a few possible sources for this:
(1) The character set of your browser doesn't understand the characters you
give it. Switching the character set may resolve the issue.
(2) You store crappy data in DB2 because your data source provides incorrect
data.
(3) Your application retrieves correct data from DB2 but garbles it up.

You should figure out what is going on and what the desired behavior should
be. Right now you don't know exactly which characters are not shown
correctly.

As for preventing certain characters, you can write triggers that either
transform the data (see TRANSFORM function) or reject it (see SIGNAL
statement).

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Thanks for u'r replay,

u'r second point very much apply to my problem. actually in our
application we provide a space to enter data to the user. at that
time he may copy the data from available web sources , so i think at
that time these junk data creeps in.
fortunately most of the junk character they enter are limited to an
ascii value of 26,
so right now i am doing like this :
replace(article,chr(26),'')

waiting for u'r suggestion

thanks

sri

Apr 3 '07 #3

P: n/a
situ wrote:
On Apr 2, 9:04 pm, Knut Stolze <sto...@de.ibm.comwrote:
>situ wrote:
Hello all,
i have a column in a table which stores tag lines which are usually
less than 500 charecter. when we display the data through the
browser some character display as "boxes" or junks. i predict it may
be the newline or carriage return character.
is there any function so that i can ward of these characters

I see a few possible sources for this:
(1) The character set of your browser doesn't understand the characters
you
give it. Switching the character set may resolve the issue.
(2) You store crappy data in DB2 because your data source provides
incorrect
data.
(3) Your application retrieves correct data from DB2 but garbles it up.

You should figure out what is going on and what the desired behavior
should
be. Right now you don't know exactly which characters are not shown
correctly.

As for preventing certain characters, you can write triggers that either
transform the data (see TRANSFORM function) or reject it (see SIGNAL
statement).

Thanks for u'r replay,

u'r second point very much apply to my problem. actually in our
application we provide a space to enter data to the user. at that
time he may copy the data from available web sources , so i think at
that time these junk data creeps in.
Are you verifying the input? Or do you don't touch it at all? In the
latter case, I see a huge security problem coming your way, for example if
there would be Javascript or whatever else allowed.
fortunately most of the junk character they enter are limited to an
ascii value of 26,
so right now i am doing like this :
replace(article,chr(26),'')
Question is how you want to deal with that. Only you can answer this. You
could cleanse the input data in your application (good idea), add triggers
at the DB level to remove unwanted characters as you shown above (good
idea), and then verify the data again when retrieving it (also a good
idea). In a robust system, you would probably want to do all three things.

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Apr 3 '07 #4

P: n/a


situ wrote:
On Apr 2, 9:04 pm, Knut Stolze <sto...@de.ibm.comwrote:
>situ wrote:
>>Hello all,
i have a column in a table which stores tag lines which are usually
less than 500 charecter. when we display the data through the
browser some character display as "boxes" or junks. i predict it may
be the newline or carriage return character.
is there any function so that i can ward of these characters
I see a few possible sources for this:
(1) The character set of your browser doesn't understand the characters you
give it. Switching the character set may resolve the issue.
(2) You store crappy data in DB2 because your data source provides incorrect
data.
(3) Your application retrieves correct data from DB2 but garbles it up.

You should figure out what is going on and what the desired behavior should
be. Right now you don't know exactly which characters are not shown
correctly.

As for preventing certain characters, you can write triggers that either
transform the data (see TRANSFORM function) or reject it (see SIGNAL
statement).

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany

Thanks for u'r replay,

u'r second point very much apply to my problem. actually in our
application we provide a space to enter data to the user. at that
time he may copy the data from available web sources , so i think at
that time these junk data creeps in.
fortunately most of the junk character they enter are limited to an
ascii value of 26,
so right now i am doing like this :
replace(article,chr(26),'')

waiting for u'r suggestion

thanks

sri
The ascii meaning of chr(26) (x'1a' or Ctrl-z) is end of file. If this
is appearing as part of a cut/paste operation, then I'd suspect that
somehow the cut/paste is inserting it at the end of the paste operation.

Phil Sherman
Apr 3 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.