[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2845
  • Last Modified:

Apostrophe " ' " shows as a "?" or sometimes a square box- is this a font or character set issue

I can not get apostrophe's to  display correctly in a web page I am building.

The text starts out on another web site.  I read the file and save chunks of it in a database.  Then later I spit that out into a web page.

The somewhere in that process I lose the apostrophe and usually get nothing in that space, or if I fiddle with char-sets I can get a "?" or the symbol for a box.

For example the work   customer's  will show up as just customers

Can someone explain this to me me?  

I need to get the apostrophe to show up in my final web page.

thanks

mike
0
bigmikey88
Asked:
bigmikey88
  • 3
  • 2
1 Solution
 
HighTechGeekCommented:
Many font sets contain a variety of apostrophe and quote symbols. Besides the standard straight apostrophe and straight quotes, there are left and right quotes and slanted apostrophes. Many Windows apps are set by default to replace straight quotes and apostrophes with "smart quotes", etc.

the best way to fix it is to paste the text into a text editor and replace the changed quotes with a normal apostrophe and then use that text on your web site to ensure you are using the normal straight apostrophe.
0
 
bigmikey88Author Commented:


I have to do this programatically, since this is being done to 300 web pages all automatically.

any advice?
0
 
HighTechGeekCommented:
The smart quotes should be a known Unicode number. If you can take a couple of the ? or box characters and figure out which Unicode numbers they are, you should be able to programmatically do a search and replace for the regular symbol.

for example, U+2018 through U+201F are various Unicode slanted apostrophes and quotes that could be replaced with the standard apostrophe (U+0027) and double quote (U+0022).

See a partial Unicode table here:
http://en.wikibooks.org/wiki/Windows_Programming/Unicode/Character_reference/2000-2FFF

also, in Windows, the "Character Map" tool is useful. Go to Start\Programs\Accessories\System Tools\Character Map

You may not even need to know the Unicode. You could copy the ? or box character and paste it into code that searches for that character. Then replace it with a regular apostrophe or quote that you have typed in a text editor. I do that in Word documents with the Find and Replace feature.
0
 
bigmikey88Author Commented:
Hey HTG,

Thanks for the info on Unicode.

I actually went off in another direction, but since you took the time to help and I did learn something useful, I'd like to award you the points.

Turns out that if I specify the character set  ISO-8859-1 whenever I read or write these files, the characters come out OK.  That was the fix.

Thx for helping

0
 
HighTechGeekCommented:
I appreciate it! I'm glad you were able to get the problem resolved. Thanks!
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now