0

I am using a custom font on the website i'm developing and some basic characters are not being displayed. What seems to be the problem?

Also i am fetching the content from MYSQL.

font characters

Is the font bad?

@font-face {font-family: Cabin_Regular; src: url('fonts/Cabin_Regular.ttf');}
@font-face {font-family: Lobster; src: url('fonts/Lobster.ttf');}
body, select, input, textarea {font-family: 'Cabin_Regular';color:white;font-size: 16px;text-shadow: 0.1em 0.1em 0.2em black;}
h1, h2, h3, h4, h5, h6 {font-family: 'Lobster'; margin-bottom: 0;padding-bottom: 0;margin-top: 0; padding-top: 0;}
David Garcia
  • 3,056
  • 18
  • 55
  • 90
  • If the glyphs don't exist in the font itself (you can check on your local computer), you're going to have to either replace the symbols with a CSS font, or use standard characters. – hohner Apr 04 '12 at 01:16

3 Answers3

3

First check if the characters are encoded for example the copyright symbol should be © in the database.

Second check if the font even supports the character some fonts don't have all of the glyphs you want. What are the characters suppose to be?

David Nguyen
  • 8,368
  • 2
  • 33
  • 49
1

Check the encoding in your MySQL database. If it's not UTF-8 you're going to have issues

if it isn't UTF-8 use the following after you've connected to the database and are about to execute a Query

mysql_set_charset('utf8',$database_Connection);

Also make sure you have the charset defined in the <head> of your html document

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

... I actually ran into this problem myself once when using a client's database which was set to Latin1. A real pain to figure out the first time.

OACDesigns
  • 2,279
  • 14
  • 24
  • In my headers i got utf, and when i populated the database i didnt specify a charset, i went an exported a found out the default is `) ENGINE=MyISAM DEFAULT CHARSET=latin1;` what can i do? how do i change it – David Garcia Apr 04 '12 at 01:39
  • use the mysql_set_charset('utf8',$Your_database_Connection); function just before you run your queries. That'll change the charset to UTF-8 while the query is being run. – OACDesigns Apr 04 '12 at 01:50
  • Thanks, i changed it in the database and all the tables are set to utf-8 `ALTER TABLE tbl_name CONVERT TO CHARACTER SET utf8;` – David Garcia Apr 04 '12 at 01:52
  • I don't think you can change the default charset in your database after it's been set. You'll have to export all your data, and repopulate a newly created Database. – OACDesigns Apr 04 '12 at 01:52
  • oh ok, I was wrong then. That's good to know. Is it working now? – OACDesigns Apr 04 '12 at 01:52
  • no lol, seems theres a problem with the characters like david said – David Garcia Apr 04 '12 at 01:55
  • do the characters display normally if you use a basic sans-serif font? – OACDesigns Apr 04 '12 at 02:00
  • Nope, here check [link](http://auto-sal.es/contactus.php) I tried sans family but didnt work, for instance, the £ pound symbol isn't showing with neither font – David Garcia Apr 04 '12 at 02:04
  • ok in that case definitely try using the `mysql_set_charset('utf8',$database_Connection);` before you execute your query in the php (I assume its PHP?). – OACDesigns Apr 04 '12 at 02:09
  • Lol that worked, but why, the tables and the database and the pages were already set to utf8, im i missing something – David Garcia Apr 04 '12 at 02:19
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/9661/discussion-between-jose-david-garcia-llanos-and-digitalbiscuits) – David Garcia Apr 04 '12 at 02:23
  • Sorry man, I gotta go to bed now. ...I'll leave you with this though. The comment here will explain why the Charset in your table didn't change http://stackoverflow.com/a/6116205/1097858 – OACDesigns Apr 04 '12 at 02:27
0

This is almost certainly an encoding issue. See http://ask.metafilter.com/mefi/28045 for some solutions.

To clarify, everything (PHP, MySQL, and even their conneciton to eachother) needs to be communicating in the same encoding or the same entities will be rendered differently. The standard is utf-8, but the important issue isn't really which is used but that it is used uniformly. There are good suggestions on how to get everything on the same page in the above link.

Sebass van Boxel
  • 2,514
  • 1
  • 22
  • 37
  • 1
    I didnt specify a charset when populating the db, however it seems that it is set to `ENGINE=MyISAM DEFAULT CHARSET=latin1;` – David Garcia Apr 04 '12 at 01:40