-2

I'm working on a spanish script:

I have this code in html:

<div class="details"><b>Detalle:</b> acompañado o no de una tableta digitalizadora, te permitirá¡ dar rienda suelta a tu imaginación y conseguir verdaderas obras de arte</div>

I need this output: (to save in Mysql Database)

<div class="details"><b>Detalle:</b> acompañado o no de una tableta digitalizadora, te permitirá dar rienda suelta a tu imaginación y conseguir verdaderas obras de arte</div>

any functions to do it ?

2
  • 2
    Why don't you store it in utf8? What's that second character set you're using?
    – Ja͢ck
    Mar 12, 2013 at 6:50
  • all content in my database is like the html output example explained above :S Mar 12, 2013 at 6:53

2 Answers 2

1

Change your mysql database/ table / column encoding to UTF-8 (and also set the collation to a compatible value).

ALTER TABLE mytable CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE mytable 
MODIFY country CHAR(50) 
CHARACTER SET utf8 COLLATE utf8_general_ci;

Also specify the char set at the PHP side when connecting.

mysql_set_charset('utf8',$conn);
0
0

mysql_real_escape_stringEscapes special characters in a string for use in an SQL statement

But that is not recommended and it's deprecated as of PHP 5.5.0.

Use this method with mysqli or PDO

4

Not the answer you're looking for? Browse other questions tagged or ask your own question.