encoding using UTL_I18N.ESCAPE_REFERENCE [message #571225] |
Thu, 22 November 2012 05:34  |
 |
rahul.rathi
Messages: 3 Registered: November 2012 Location: India
|
Junior Member |
|
|
Hi All,
I am facing a problem with UTL_I18N.ESCAPE_REFERENCE.
In my project to protect against xml injection problem the data entered by the user is being encoded and passed to database.
for any special characters received as input, the application encodes this data
eg if the user enters encoded
< <
> >
And so on.
I can use the UTL_I18N.UNESCAPE_REFERENCE function and get the exact string entered by user.
Select UTL_I18N.UNESCAPE_REFERENCE('<>') x from dual;
Output
x
------
<>
But when i use the UTL_I18N.ESCAPE_REFERENCE function to encode the above output it gives me some other string
Select UTL_I18N.ESCAPE_REFERENCE('<>') x from dual;
Output
x
------------
<>
Can someone please help me get the string to encoded to original i.e '<>'.
Thanks in advance
Rahul.
|
|
|
|
Re: encoding using UTL_I18N.ESCAPE_REFERENCE [message #571357 is a reply to message #571230] |
Sat, 24 November 2012 07:03   |
 |
rahul.rathi
Messages: 3 Registered: November 2012 Location: India
|
Junior Member |
|
|
Hi Michel,
Thanks for the quick response. But the solution provided will not work as its just for a selced few charachters i can replace. but there can be may other characters that needs to be replaced. I think there should be some other function provided by oracle to achieve this. From my findings the values i am looking for are hex. Please refer to below link.
htmlhelp.com/reference/html40/entities/special.html
just check this link.
[Updated on: Sat, 24 November 2012 07:12] Report message to a moderator
|
|
|
Re: encoding using UTL_I18N.ESCAPE_REFERENCE [message #571359 is a reply to message #571357] |
Sat, 24 November 2012 08:44   |
 |
Michel Cadot
Messages: 68770 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Quote:but there can be may other characters that needs to be replaced.
Did you test for the other characters?
Quote:Please refer to below link.
If these are the limited list then you can either statically implements it in the query to trasnform what you don't want into what you do or use a reference table to do so.
Regards
Michel
[Updated on: Sat, 24 November 2012 08:46] Report message to a moderator
|
|
|
|
|