views:

327

answers:

5

Hi there,

I have been developing with some software for javscript that has a parser that reads in my JS and creates a compressed version, it kept failing as by default vs 2008 saves its files in UTF8 from what i see.. there was like a hidden couple of characters at the start of the file..

Forcing a save as 1252 sorted the issue, my question is really what should i be using 1252 or utf8.

I need to use special European accents on letters, i am a little lost. I notice in eclipse it uses by default 1252 i think..

so why does vs 2008 force utf8?? and which should i be using,,

Using 1252 will cause issues?

Any ideas really appreciated

+8  A: 

UTF-8 is a better option as it really support all known characters, while with 1252 you might end up with characters that you need missing from it (even in European languages).

Apparently, VS2008 saves UTF-8 with a byte order mark - it should be possible to either switch that off, or have the parser recognize it, or strip the BOM somewhere in between.

Michael Borgwardt
You can use the "Save with encoding" option in the save dialog and then explicitly select "UTF-8 without signature".
Joey
Yep thanks guys I saved it with No signature... and it appears to have worked... Is there anyone to say save / Create by default UTF-8 without signature in vs 2008?
mark smith
+2  A: 

utf-8 has byte order mark (BOM) signature at the beginning of a file which some editors, and obviously libraries don't understand... http://en.wikipedia.org/wiki/Byte-order_mark

if you can get around it, UTF-8 is preferred today by all means. try stripping that first bytes of BOM before giving the JS code to that parser, or find an option in your IDE if it can not write that

1252 doesn't cause this issue and you won't have problems with it, but you'll output your web in an outdated format, i wouldn't do it today, there was a lot of encoding mess on the web in the past with iso vs. win codepages for different languages...

zappan
A: 

BOM was at the start of the file. IMHO you should use utf8, its very current nowadays.

erenon
A: 

Use UTF-8. 1252 does not cover whole Europe, so in some countries (central Europe) you should use 1250, or more correctly - iso 8859-2. So the only real option is UTF-8.

smok1
A: 

Using 1252 will cause issues?

Depends on the countries you app needs to work in

From the Top of my head, 1252 (or ISO 8859-1) will work in

  • UK
  • Germany
  • Switzerland
  • Austria
  • Italy
  • France
  • Netherlands
  • Iceland
  • Spain

Oh, Wikipedia has a more comprehensive List: http://en.wikipedia.org/wiki/ISO/IEC_8859-1

So you can use CP 1252 if your app is only used in the mentioned countries/languages.

jms
ISO 8859-1 has a couple of issues for rare French words, hence ISO 8859-15 was created.
Richard