473,385 Members | 1,341 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Replace problem

I am storing HTML in an oracle database, this is loaded from a textbox
in a webpage, I convert ' to ' ' using the code below:

foo.Replace("'", "''").Replace("&", "'||'&'||'")

this works just fine, then when I retrieve the text from the database
and display it in a webpage, I convert it back using:

objdr.Item("foo").Replace("''", "'").Replace("'||'&'||'", "&")

For some reason this then ends up converting ' ' not to ' but to an
upside down question mark ¿, not sure of the correct terminology for
that.

Any thoughts on why it is doing this and how to prevent it?

Thanks in advance

Mar 24 '06 #1
4 2193
I'm not exactly sure what you're trying to do -- all your quotes are
running together. Are you trying to convert one single quote
(apostrophe) to two single quotes (two apostrophes) or one double quote
mark? Anyway, to get a double quote in VB you need to do (or can do)
this very strange thing.
dim strDoubleQuote as String
strDoubleQuote = """" ' 4 double quotes evaluates to a single
double quote.
strSingleQuote = "'" ' Apostrophe encased in double quotes.
Perhaps that will help you. Or you can use the CHR function with the
proper ASCII code for the quote you want.

So to replace singles by doubles do
foo = Replace(foo, strSingleQuote, strDoubleQuote)

Mar 28 '06 #2
Hi,

Actually I think I have an idea what AZNewsh is doing. He is using a
familiar technique to clean up his HTML before it enters the database.
Something similar to preventing SQL Injection, I think.

So, he is converting a single quote to 2 single quotes, and when
retrieving data back from the database, he is converting the 2 single
quotes back to a single quote.

Though I have no idea why he could be getting an "inverted question
mark" (Yes, that's what it's called, according to Charmap.)

Regards,

Cerebrus.

Mar 28 '06 #3
Correct that is exactly what I am trying to do, it works fine in so far
as it cleans up the quotes before entering the database. I have since
been informed that it doesn't actually replace with 2 single quotes,
just fools Oracle somehow, so i actually don't need to reverse it, it
does however even look like a an inverted question mark even in the
database when viewed through Toad, haven't tried SQL Plus but expect
the same, I did put a replace in place that will now convert the
inverted question mark back to an apostrophe, when selecting and this
works but seems like a rather none elegant solution

Any thoughts?

AZNewsh

Apr 3 '06 #4

"AZNewsh" <gn@dana.ucc.nau.edu> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
Correct that is exactly what I am trying to do, it works fine in so far
as it cleans up the quotes before entering the database. I have since
been informed that it doesn't actually replace with 2 single quotes,
just fools Oracle somehow, so i actually don't need to reverse it, it
does however even look like a an inverted question mark even in the
database when viewed through Toad, haven't tried SQL Plus but expect
the same, I did put a replace in place that will now convert the
inverted question mark back to an apostrophe, when selecting and this
works but seems like a rather none elegant solution

Any thoughts?


ISTR that Oracle has weird notions about some characters, including
wildcards. It also has optional character map pages. Don't know if it helps.
Apr 6 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Barnes | last post by:
Does anyone know of a good way to use the JavaScript string.replace() method in an ASP form? Here is the scenario: I have a form that cannot accept apostrophes. I want to use the replace() so...
1
by: Thomas | last post by:
It looks like the String.replace doesn't work in IE6.1. Anyone else has the same problem. I am using newest service package of IE and Win2K. Thanks
2
by: Daniel | last post by:
I use an Access database to basically take data exports, import them, manipulate the data, and then turn them into exportable reports. I do this using numerous macros, and queries to get the data...
3
by: Dave | last post by:
I have an Access 2K application that is distributed to about a dozen users (all with identical NT environments and identical Access versions, object libraries and service packs). I am using the VBA...
2
by: Raed Sawalha | last post by:
I have the following text:- Brian went to stadium to watch the soccer game, Brian MacWoods is bussiness man and very rich man. Brian likes to run every morning on beachside. the problem i...
6
by: Chris Anderson | last post by:
Anyone know of a fix (ideally) or an easy workaround to the problem of escape characters not working in regex replacement text? They just come out as literal text For example, you'd think that thi...
5
by: enno | last post by:
Dear Community, We have a problem with null-Bytes in varchar-Columns, which are not handled correctly in our application. Therefor we try to filter them out using the Transact-SQL REPLACE...
3
by: Niyazi | last post by:
Hi all, I have a dataTable that contains nearly 38400 rows. In the dataTable consist of 3 column. column 1 Name: MUHNO column 2 Name: HESNO Column 3 Name: BALANCE Let me give you some...
6
by: JackpipE | last post by:
Here is my replace query and I need to run this on every column in my table. Right now I manually enter the column name (_LANGUAGES_SPOKEN) but this is time consuming and would like to automate...
5
by: V S Rawat | last post by:
I was trying to use back-to-back replace functions to convert a url: str1 = str.replace("%2F","/").replace("%3F","?").replace("%3D","=").replace("%2 6","&"); It didn't replace all 4 types of...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.