472,779 Members | 2,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Allowing special characters in a MySql Database

let me just say. it's not by choice but im dealing with a .net web app (top
down approach with VB and a MySQL database) sigh.....

Anyhow, I've just about got all the kinks worked out but I am having trouble
preserving data as it gets entered into the database. Primarily, quotes and
special characters.

Spcifically, I noticed it stripped out some double quotes and a "Registered"
symbol ® (not the ascii but the actual character"

does anyone know of a quick fix to allow these types of characters? The
forms are in a secured section of the site and will only be used by
adinistrators so im not TOO concerned about what they enter in at this
point.

Thanks for any suggestions!
Oct 6 '05 #1
4 5159
have you tried escaping them with a backslash eg. \'

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Ewok" <ew**@triad.rr.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
let me just say. it's not by choice but im dealing with a .net web app
(top down approach with VB and a MySQL database) sigh.....

Anyhow, I've just about got all the kinks worked out but I am having
trouble preserving data as it gets entered into the database. Primarily,
quotes and special characters.

Spcifically, I noticed it stripped out some double quotes and a
"Registered" symbol &reg; (not the ascii but the actual character"

does anyone know of a quick fix to allow these types of characters? The
forms are in a secured section of the site and will only be used by
adinistrators so im not TOO concerned about what they enter in at this
point.

Thanks for any suggestions!

Oct 6 '05 #2
That would be quite a task to eascape all special characters. There has to
be an easier way..... hmm or would it?

I know i ColdFusion regular expressions there is a [:special:] character
set. Maybe I can use something similar in dotnet/vb to easily match
characters that would need to be escaped?

"John Timney (ASP.NET MVP)" <ti*****@despammed.com> wrote in message
news:uc**************@TK2MSFTNGP14.phx.gbl...
have you tried escaping them with a backslash eg. \'

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Ewok" <ew**@triad.rr.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
let me just say. it's not by choice but im dealing with a .net web app
(top down approach with VB and a MySQL database) sigh.....

Anyhow, I've just about got all the kinks worked out but I am having
trouble preserving data as it gets entered into the database. Primarily,
quotes and special characters.

Spcifically, I noticed it stripped out some double quotes and a
"Registered" symbol &reg; (not the ascii but the actual character"

does anyone know of a quick fix to allow these types of characters? The
forms are in a secured section of the site and will only be used by
adinistrators so im not TOO concerned about what they enter in at this
point.

Thanks for any suggestions!


Oct 6 '05 #3
php has an escape function specifically for mySQL inserts

Historically, you have had to hand crank one using the replace method,
something like this:
private string SafeSqlLiteral(string inputSQL)
{
return inputSQL.Replace("'", "''");
}or calling Microsoft.JScript.GlobalObject.escape I guess it depends where
your problem is occuring - it may be mySQL expecting escaped chars, you
could try passing verbatim strings using the '@' symbol before the quoted
sql statement --
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Ewok" <ew**@triad.rr.com> wrote in message
news:O7**************@TK2MSFTNGP09.phx.gbl...
That would be quite a task to eascape all special characters. There has to
be an easier way..... hmm or would it?

I know i ColdFusion regular expressions there is a [:special:] character
set. Maybe I can use something similar in dotnet/vb to easily match
characters that would need to be escaped?

"John Timney (ASP.NET MVP)" <ti*****@despammed.com> wrote in message
news:uc**************@TK2MSFTNGP14.phx.gbl...
have you tried escaping them with a backslash eg. \'

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Ewok" <ew**@triad.rr.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
let me just say. it's not by choice but im dealing with a .net web app
(top down approach with VB and a MySQL database) sigh.....

Anyhow, I've just about got all the kinks worked out but I am having
trouble preserving data as it gets entered into the database. Primarily,
quotes and special characters.

Spcifically, I noticed it stripped out some double quotes and a
"Registered" symbol &reg; (not the ascii but the actual character"

does anyone know of a quick fix to allow these types of characters? The
forms are in a secured section of the site and will only be used by
adinistrators so im not TOO concerned about what they enter in at this
point.

Thanks for any suggestions!



Oct 6 '05 #4
Yes, I was looking all over for an equivelant to addslashes() for .NET

I originally thought it was MySQL stripping them out but I did a
response.write() for all my text field values and apprently it is removing
the characters on postback of the form since they were missing before the
query was ever ran.

It only happens with regular asp:textbox fileds though. I have FCKEditor on
the same form and it replaces things like the registered symbol with &reg;
for you (nice)

I must also be losing my mind because quotes go into the database just fine
now. It only stripped those out one time... weird. I am still faced with all
of the other symbols though which will most likely be used often in this
application tradmarks, copyright, registered, etc...

I have validaterequest=false in my page directive so that must not be it (i
can submit html with the fckeditor just fine)

It seems like it might be a little harder than I thought since .net is
actually removing the characters when i hit the submit button though. It
just seems like there would be an easy way of doing this. I hope someone can
offer a solution before I run out of other sections to work on : )

I may have to write a function to convert all the symbols intot their ascii
value... man that could get big and slow....

I've never used Microsoft.JScript.GlobalObject.escape/unescape but im about
to go look into that. Thanks for the tips
"John Timney (ASP.NET MVP)" <ti*****@despammed.com> wrote in message
news:uo**************@TK2MSFTNGP10.phx.gbl...
php has an escape function specifically for mySQL inserts

Historically, you have had to hand crank one using the replace method,
something like this:
private string SafeSqlLiteral(string inputSQL)
{
return inputSQL.Replace("'", "''");
}or calling Microsoft.JScript.GlobalObject.escape I guess it depends
where your problem is occuring - it may be mySQL expecting escaped chars,
you could try passing verbatim strings using the '@' symbol before the
quoted sql statement --
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Ewok" <ew**@triad.rr.com> wrote in message
news:O7**************@TK2MSFTNGP09.phx.gbl...
That would be quite a task to eascape all special characters. There has
to be an easier way..... hmm or would it?

I know i ColdFusion regular expressions there is a [:special:] character
set. Maybe I can use something similar in dotnet/vb to easily match
characters that would need to be escaped?

"John Timney (ASP.NET MVP)" <ti*****@despammed.com> wrote in message
news:uc**************@TK2MSFTNGP14.phx.gbl...
have you tried escaping them with a backslash eg. \'

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Ewok" <ew**@triad.rr.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
let me just say. it's not by choice but im dealing with a .net web app
(top down approach with VB and a MySQL database) sigh.....

Anyhow, I've just about got all the kinks worked out but I am having
trouble preserving data as it gets entered into the database.
Primarily, quotes and special characters.

Spcifically, I noticed it stripped out some double quotes and a
"Registered" symbol &reg; (not the ascii but the actual character"

does anyone know of a quick fix to allow these types of characters? The
forms are in a secured section of the site and will only be used by
adinistrators so im not TOO concerned about what they enter in at this
point.

Thanks for any suggestions!



Oct 6 '05 #5

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

Similar topics

12
by: Mosher | last post by:
Hi all, I have an issue with php and/or mysql. I have a php form that writes "items" to a mysql database, including a description of the item. On the mysql server, "magic_quotes_gpc" is ON. I...
7
by: John | last post by:
I am having problems with special characters with database calls (if I'm referring to this in the right way). the problem is with apostrophes of all things. If an end user puts an apostrophe in...
4
by: Ewok | last post by:
let me just say. it's not by choice but im dealing with a .net web app (top down approach with VB and a MySQL database) sigh..... Anyhow, I've just about got all the kinks worked out but I am...
9
by: Larry | last post by:
OK, I've been searching around the net for numerous hours and seem to just be getting more confused about handling special characters. In my host's configuration MagicQuotes is ON. (I understand...
25
by: Wim Cossement | last post by:
Hello, I was wondering if there are a few good pages and/or examples on how to process form data correctly for putting it in a MySQL DB. Since I'm not used to using PHP a lot, I already found...
1
by: ronrsr | last post by:
I have an MySQL database called zingers. The structure is: zid - integer, key, autoincrement keyword - varchar citation - text quotation - text I am having trouble storing text, as typed in...
1
by: ronrsr | last post by:
I have an MySQL database called zingers. The structure is: zid - integer, key, autoincrement keyword - varchar citation - text quotation - text I am having trouble storing text, as typed in...
6
by: TheRealDan | last post by:
Hi all. I'm having a problem with a special characters. I have php script that reads from an xml file and writes to a mysql db. It's a script called phptunest that I found on the net, although the...
2
by: matech | last post by:
I have a problem with uploading special characters from excel files to mysql 5. It doesn't matter if I use UTF-8 or iso-8859-1 when uploading the trademark symbol. htmlspecialchars() or...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.