Home Download Buy Blog Forum Support

Character encoding issue

Character encoding issue

Postby sevenbest on Tue Feb 12, 2013 2:54 pm

Hello,

I am having problems with Sublime Text (2.0.1) on Windows 7.

I've noticed the problem most when using the pound/sterling character (£).

When I view the resulting file in a web browser I see £.

This happens whether I type the character myself or copy it from elsewhere.

I can recreate this by creating a new txt file and using Sublime to save '£££'. Viewing the file in Firefox I then see '£££'.

If I do this same process using notepad.exe then I see the correct ouput.

If I use sublime and choose save with encoding 'UTF-8 With BOM' then I also see the correct output. However, because of the extra characters saving with the BOM option adds to the start of the file, this is not a solution I can use.

Any help will be greatly appreciated

Sevenbest
sevenbest
 
Posts: 2
Joined: Tue Feb 12, 2013 2:35 pm

Re: Character encoding issue

Postby bizoo on Tue Feb 12, 2013 3:11 pm

sevenbest wrote:If I use sublime and choose save with encoding 'UTF-8 With BOM' then I also see the correct output. However, because of the extra characters saving with the BOM option adds to the start of the file, this is not a solution I can use.

It doesn't work if you save it using 'UTF-8' ?
What do you want to do ?

Opening a text file in a browser doesn't make much sense;
either your txt file contains a BOM and it will probably works,
or your browser try to guess the encoding, or use the one you specified in the options, and it's not reliable.

A html file contains an encoding tag that resolve your issue.
bizoo
 
Posts: 883
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: Character encoding issue

Postby sevenbest on Tue Feb 12, 2013 4:10 pm

It's a problem I had noticed when saving HTML files.
bizoo wrote:
sevenbest wrote:If I use sublime and choose save with encoding 'UTF-8 With BOM' then I also see the correct output. However, because of the extra characters saving with the BOM option adds to the start of the file, this is not a solution I can use.

It doesn't work if you save it using 'UTF-8' ?
What do you want to do ?

Opening a text file in a browser doesn't make much sense;
either your txt file contains a BOM and it will probably works,
or your browser try to guess the encoding, or use the one you specified in the options, and it's not reliable.

A html file contains an encoding tag that resolve your issue.


I was opening the text file in the browser because I thought it would be a simple way to demonstrate the problem.

I am actually editing HTML on a platform where the encoding tag is predetermined .

You were right, the encoding tag wasn't UTF-8 and setting my default encoding in Sublime to Western (ISO 8859-1) has fixed this problem.

Thank you very much for helping me to understand this problem.
sevenbest
 
Posts: 2
Joined: Tue Feb 12, 2013 2:35 pm


Return to Technical Support

Who is online

Users browsing this forum: skube and 26 guests