![]() |
problem when copying fom "MS Word" to database
I have a form in the user interface of my website, where the user can type in a paragraph and it will display on a page of their website.
It works fine if they just type it in, BUT if if they type their content in "MS Word" and then COPY it into the textarea (in my user input), I get a wierd charactor everyplace there should be a double quote " or a series of periods. I think "Word" does not always output normal asscii characters. In summary..... Double quotes normally look like this ", whereas copied from “Word”, they look like this ” And series of periods normally look like this . . . . whereas Word converts them to this …………… Is there anyway to deal with this? Thank you in advance. |
No, of course MS Word (or *ANY* good word processing program!) does not limit itself to the silly limited set of ASCII characters! Why would it *WANT* to?
Word processors *want* to use all those characters to make the final output look better. So they use "smart quotes" and en-dashes and em-dashes and ellipses and much more Quote:
If you are going to allow people to paste word processed text into your <textarea>s, or even into standard text fields, then you will need to store the text as UNICODE and *NOT* as ASCII. In MySQL, that means storing the data as UTF8, most likely. You can specify that all fields in a table are Unicode by putting the charset at the end of CREATE TABLE, thus: Code:
CREATE TABLE mytable (Code:
CREATE TABLE mixed ( |
By the by, if you have an existing table that has been specified wrongly, you *CAN* alter it.
How to tell? Use the SHOW CREATE TABLE yourtablename; command. It will dump out the table and show you the CHARSET default for the entire table and the character set of each field, if different than the table default. For example: Code:
mysql> show create table xxx;So I can do: Code:
mysql> alter table xxx modify name varchar(100) charset utf8;Easy with MySQL! |
Wow. That enlightened me. Very interesting.
Thank you very much Old Pendant. |
| All times are GMT +1. The time now is 04:00 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.