473,549 Members | 3,048 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5248
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******** ********@TK2MSF TNGP14.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*****@despam med.com> wrote in message
news:uc******** ******@TK2MSFTN GP14.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******** ********@TK2MSF TNGP14.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.Replac e("'", "''");
}or calling Microsoft.JScri pt.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******** ******@TK2MSFTN GP09.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*****@despam med.com> wrote in message
news:uc******** ******@TK2MSFTN GP14.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******** ********@TK2MSF TNGP14.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.JScri pt.GlobalObject .escape/unescape but im about
to go look into that. Thanks for the tips
"John Timney (ASP.NET MVP)" <ti*****@despam med.com> wrote in message
news:uo******** ******@TK2MSFTN GP10.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.Replac e("'", "''");
}or calling Microsoft.JScri pt.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******** ******@TK2MSFTN GP09.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*****@despam med.com> wrote in message
news:uc******** ******@TK2MSFTN GP14.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******** ********@TK2MSF TNGP14.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
28564
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 am testing it now by putting special characters in the description field, this is what I am entering: O'Leary "special edition"
7
2983
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 something ASP will interprete it as a delimiter. This is aggravating because I'm trying to make this as simple for the end user as possible and if...
4
750
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 having trouble preserving data as it gets entered into the database. Primarily, quotes and special characters. Spcifically, I noticed it stripped...
9
2554
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 this is considered a bad thing by many) A user submitted an email in the form 'Bob Smith' <bob@nospam.com> Now when I look in the MySql database...
25
5310
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 out that addslashes() can be used escape some characters, but I'm having some more problems with for instance ä, å and µ (since the text is...
1
3017
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 latter two fields. Special characters and punctuation all seem not to be stored and retrieved correctly.
1
1761
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 latter two fields. Special characters and punctuation all seem not to be stored and retrieved correctly.
6
3863
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 original website for the author appears to be gone. It works really nicely except when it hits special characters. Everything from a sp char...
2
3565
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 htmletities() doesn't help? the database doesn't show the data in the field but replaces it with the binary/Image information. the following are examples...
0
7446
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7718
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7956
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7809
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5088
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3498
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1936
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
763
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.