Sublime Forum

Character encoding issue

#1

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

0 Likes

#2

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.

0 Likes

#3

It’s a problem I had noticed when saving HTML files.

[quote=“bizoo”]

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.[/quote]

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.

0 Likes