Re: convert special characters.
Karl DeSaulniers <[email protected]>
| Newsgroups | gmane.comp.php.database |
|---|---|
| Message-ID | <[email protected]> |
Hey anything is better than nothing. Thanks for the effort. I will investigate this further. Did not know mysql_real_escape_string was depreciated. Good to know. Thank you! Best, Karl On Aug 9, 2012, at 4:30 PM, Graham H. wrote: > Not sure if this will work any better, but have you tried using > htmlspecialchars instead of htmlentities? http://www.php.net/manual/en/function.htmlspecialchars.php > > You should also use mysqli_real_escape_string instead of the older > (and deprecated) mysql_real_escape_string. When you use the mysqli > you'll need to pass in a link to your database as the first > parameter, with the string to be escaped as the second. This will > also require you to use mysqli objects I'm pretty sure (which are > better to be using in the first place). See more about it here: http://ca3.php.net/manual/en/mysqli.real-escape-string.php > > Better than nothing? Sorry! > > On Thu, Aug 9, 2012 at 3:19 PM, Karl DeSaulniers > <[email protected]> wrote: > > On Aug 9, 2012, at 5:41 AM, Karl DeSaulniers wrote: > > > On Aug 9, 2012, at 5:37 AM, Karl DeSaulniers wrote: > > Help! > > How do I get special characters to convert correctly when inserting > and reading from my database. > For example. > > é => é > ë => ë > > I keep getting > > ë and é > > using htmlentities, htmlspecialchars, etc... > > Any pointers? Please! > Going bald over here. > > here is my funcitons > > function stringToMysqlFormat($original_input) { > //for inserting the data with special characters INTO > mysql > $html_encoded = > htmlentities(mysql_real_escape_string($original_input)); > return $html_encoded; > } > function mysqlToHTMLFormat($encoded) { > //for displaying the data FROM mysql > $html_decoded = > html_entity_decode(stripslashes($encoded)); > return $html_decoded; > } > > TIA, > > Karl DeSaulniers > Design Drumm > http://designdrumm.com > > > > using UTF-8 > > > Karl DeSaulniers > Design Drumm > http://designdrumm.com > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > No one? > Not even a link I can go look this up myself with? > > I have successfuly converted before, but this time the company > is in the netherlands and their special characters are doing this. > Also, I have the database set to UTF-8, but when I check the charset: > > $charset = mysql_client_encoding($con); > > it returns latin1? > > Can someone tell me what I am doing wrong here? > Not looking for someone to do it for me. > Just some help figuring out which way to look. > > Why is htmlentities() converting wrong? > > Hope someone out there can help. > > > TIA, > > Karl DeSaulniers > Design Drumm > http://designdrumm.com > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- > Graham Holtslander > Computer Systems Technologist > www.graham.holtslander.com > [email protected] Karl DeSaulniers Design Drumm http://designdrumm.com