You are viewing our Forum Archives. To view or take place in current topics click here.
[PHP] [MYSQL] Problem showing apostrophes
Posted:

[PHP] [MYSQL] Problem showing apostrophesPosted:

GamerTechz
  • TTG Addict
Status: Offline
Joined: Feb 11, 201212Year Member
Posts: 2,185
Reputation Power: 88
Status: Offline
Joined: Feb 11, 201212Year Member
Posts: 2,185
Reputation Power: 88
I am making my own news system, and I can't display apostrophes for some reason. This is what they look like: [ Register or Signin to view external links. ]

For some reason php is not showing apostrophes that are in the database or do I need to do something special to get them showing like normal? Please help I've been working on this for a while now and this is a slight problem that I have not a clue how to fix.
#2. Posted:
iyop45
  • Prospect
Status: Offline
Joined: Apr 15, 201113Year Member
Posts: 614
Reputation Power: 83
Status: Offline
Joined: Apr 15, 201113Year Member
Posts: 614
Reputation Power: 83
Unless you're using some strange encoding or table collation I really don't know why that could be happening. You should really be using UTF-8 and utf8_general_ci for your table.

Though have you even looked in the table? I doubt it is showing that character there. At least say where you're seeing it, is it in the text editor? or the output from php in your browser?

I'm actually getting tired of bothering with these types of questions here. Don't expect a solution if you can't even explain your situation. Saying "there's a weird character how do I fix it" is of no use to anyone.
#3. Posted:
GamerTechz
  • TTG Addict
Status: Offline
Joined: Feb 11, 201212Year Member
Posts: 2,185
Reputation Power: 88
Status: Offline
Joined: Feb 11, 201212Year Member
Posts: 2,185
Reputation Power: 88
Well if you could read the title of this, its an apostrophe that is not showing correctly.
#4. Posted:
GameDev14
  • Junior Member
Status: Offline
Joined: Jan 10, 201410Year Member
Posts: 80
Reputation Power: 3
Status: Offline
Joined: Jan 10, 201410Year Member
Posts: 80
Reputation Power: 3
GamerTechz wrote Well if you could read the title of this, its an apostrophe that is not showing correctly.


Maybe next time give a more detailed explanation to what your problem is. Also if you haven't already delare the encoding of your webpage in your page
<meta charset="UTF-8">

also Your database is probably set to a character encoding like LATIN_1 (or swedish_1) which doesn't display certain characters
#5. Posted:
kpempire
  • Challenger
Status: Offline
Joined: Jan 20, 201410Year Member
Posts: 115
Reputation Power: 4
Status: Offline
Joined: Jan 20, 201410Year Member
Posts: 115
Reputation Power: 4
I don't understand exactly what your situation is, but I have a few solutions that may fix your problem with a bit of fussing. If the problem still persists, feel free to PM me.

Solution 1: "UTF-8"
Add the following to your code.

<meta http-equiv="Content-Type" content="text/html;UTF-8">

If your website is a html5, use this.

<meta charset="UTF-8">

Solution 2: "Database Language"

As said above, your database is probably in some stupid language. Make sure it's set to the default.

Solutution 3: "Special Characters"
Add this to your code.

htmlspecialchars()

This will convert any metacharacters into their character equivalents and should display correctly.
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.