Prev: Help
Next: Strange query
From: situ on 2 Apr 2007 07:35 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
From: Knut Stolze on 2 Apr 2007 12:04 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
From: situ on 3 Apr 2007 02:00 On Apr 2, 9:04 pm, Knut Stolze <sto...(a)de.ibm.com> wrote: > 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
From: Knut Stolze on 3 Apr 2007 10:23 situ wrote: > On Apr 2, 9:04 pm, Knut Stolze <sto...(a)de.ibm.com> wrote: >> 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
From: Phil Sherman on 3 Apr 2007 13:11 situ wrote: > On Apr 2, 9:04 pm, Knut Stolze <sto...(a)de.ibm.com> wrote: >> 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
|
Pages: 1 Prev: Help Next: Strange query |