Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning HTML, XHTML, CSS, and JavaScript
This is the forum to discuss the Wrox book Beginning HTML, XHTML, CSS, and JavaScript by Jon Duckett; ISBN: 978-0-470-54070-1
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning HTML, XHTML, CSS, and JavaScript section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 9th, 2011, 03:11 PM
justinneng
Guest
 
Posts: n/a
Post character encoding

Hello all,
I am using dreamweaver cs5. when i start a new xhtml 1.0 strict page, among the default text that appears in the page there is this line,

Code:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Now based on the book, i typed the xml declaration as follows right in the beginning of the page

Code:
<?xml version="1.0" encoding="iso-8859-1"?>
in the first code the charset is utf-8 while in the xml declaration the the encoding is iso-8859-1. are these two different values supposed to be the same? I am asking this because in the book on page 58 and 59, in the try it out section there is an example where the encoding is iso-8859-1. so is the charset in the <meta http-equiv.... line (page 59).
Reply With Quote
  #2 (permalink)  
Old December 11th, 2011, 02:27 PM
Authorized User
Points: 105, Level: 2
Points: 105, Level: 2 Points: 105, Level: 2 Points: 105, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2010
Posts: 19
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Yes they should be the same. Since your Dreamweaver is set to UTF-8, I would continue to use UTF-8 for the meta tag, and if you do include an XML Declaration it should have the same (but fewer people seem to be using the XML Declaration these days on web pages).

I'm not an expert on this, but to try and explain a bit more:

First, you need to consider the characters that you want to use on your page. iso-8859-1 is OK for Western Europan languages such as English, French and German, but if you want to deal with Japanese, Chinese, Thai, Hindi or many others the characters are not included in iso-8859-1 and you should use UTF-8.

Second, you need to know how your program is saving the code. The actual html file for the page must be saved as UTF-8 / iso-8859-1 (there is no point writing one of these in the source code if the file is not saved in that same format). In Dreamweaver, I think you go to the preferences menu, and select the New Document options from the left then you will see an option that says "Default encoding" and you probably have UTF-8 selected there. This is fine because it should save it in that format.

So what happens is that, if a file is saved in iso-8859-1 (also often known as Latin-1), but contains characters from other characters not supported in it, then they will not show up correctly (that is when you might see that diamond shape with a question mark in it).
Reply With Quote
  #3 (permalink)  
Old December 11th, 2011, 03:07 PM
justinneng
Guest
 
Posts: n/a
Default Thanks @bitnap

thank there @ bitnap.

i guess i should go for utf-8 encoding since there are lot of chances hindi may come into picture.

In preferences, the default encoding is already utf-8. perhaps that's why the default meta tag is utf-8.

anyway thanks once again!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Encoding Will C# 2008 aka C# 3.0 0 January 11th, 2010 02:42 PM
Invalid Character in the given encoding mswin XSLT 3 November 28th, 2008 06:01 AM
encoding problem with arabic character farukcse Pro PHP 0 November 15th, 2007 04:44 PM
encoding paarupalli J2EE 0 March 2nd, 2007 04:14 AM
encoding alihussein3 Javascript How-To 1 October 28th, 2003 05:23 AM



All times are GMT -4. The time now is 03:22 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.