I'm pretty sure I'm missing something basic, but I can't figure out what it is. Everything should be default characterset (I haven't specified or changed anything) which I assume is Latin1. This should be fine as all the characters I need are in Latin1 (most questions seem directed at changing charset to utf-8).
I used copy and paste from an HTML page with charset=iso-8859-1 to insert some letters with acutes and umlauts into a MYSQL database, which shows up fine when selected from the commandline. However well I select these in a PHP script and display wi开发者_JAVA百科th iso-8859-1 as the browser encoding, they show up as commas or apostrophes only.
ä = „ ö = ” é = ‚ á = (a blank)
If I just copy and paste these vowels below the actual php tags, they display correctly.
Try using htmlentities()
I think that worked for me in the past.
Make sure that where you're displaying your data has a <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
and that your MySQL table is set accordingly. Mine is set to MyISAM, latin1--cp1252 West European, latin1_spanish_ci
and it solved my problems!
(I had imported an Excel sheet into MySQL using Navicat, and the sheet contained special characters like "á" and such.)
精彩评论