Re: special chars in Strings
Posted in 1999
theo
Thats the first part. Sorry I didn't explain myself completely, leading you to
conclude that the string once inserted will magically convert to the ascii
equivalent of the hex codes. When you select the string, you need to convert it
back in your client code.
In case of the browser running HTML (which does not do anything with <CR><LF>,
BTW), when you replace a <CR><LF> with <BR>, you dont have to do anything when
you display it, since HTML translates a <BR> as a line break. Other special
chars can be represented by their hex equivalents (in the form &#nn;) which HTML
will correctly display.
However I read in one of your mails that your application is a Windows client,
in which case you would have to do the reverse translation when you display it.
The reason you need to apply the hex translation to your string going in and the
reverse translation to your string on the way out of the database is because
CHAR and VARCHAR have trouble accepting non-printable chars in it. Frex
"thats all
folks"
is not a properly formatted string but
"thats all folks" or "thats all<br>folks" or "thats all folks"
is.
HTH
Sujit
gptheo@my-deja.com on 11/15/99 04:17:38 PM
Please respond to gptheo@my-deja.com
To: informix-list@iiug.org
cc: (bcc: Sujit Pal)
Subject: Re: special chars in Strings
In article <80ppm9$9mb$1@news.xmission.com>,
Sujit.Pal@bankofamerica.com wrote:
>
>
> theo
>
> If you are using CHAR or VARCHAR, you would need to change the
special chars to
> text strings before insert. If you dont want to do this, you could
look at the
> TEXT data type. If this is an internet application, you can simply
convert \\r to
> '' (to take care of Unix browsers), then convert \\n to <BR>. All other
> non-alphamerics you can convert to the appropriate &hex_code; string.
>
> HTH
> Sujit
>
Hi,
It didn't worked, or I didn't understand it.
I've tried :
Insert into myTable (id, name) values (0," that's all ");
After the execution, in the table is the string " that's all
", not the "that's all <CR><LF>"
I tried with other hex codes and still the same result.
Is there any escape character so I can insert something like that ?
thanks,
theo
Sent via Deja.com http://www.deja.com/
Before you buy.