Sublime Forum

EncodingHelper ( Encoding on status bar, Convert to UTF8 )

#13

When start,it shows the error message:
Reloading plugin E:\Sublime Text 2\Data\Packages\EncodingHelper\EncodingHelper.py
Traceback (most recent call last):
File “.\sublime_plugin.py”, line 62, in reload_plugin
File “.\EncodingHelper.py”, line 362, in
encoding_cache = EncodingCache()
File “.\EncodingHelper.py”, line 311, in init
self.load()
File “.\EncodingHelper.py”, line 334, in load
self.encoding_cache = json.load(fp)
NameError: global name ‘json’ is not defined
please help

0 Likes

#14

That message is not from this plugin.

Try installing this: github.com/SublimeText/EncodingHelper

0 Likes

#15

Is this plugin work with ST3?

0 Likes

#16

No yet…

0 Likes

#17

github.com/SublimeText/EncodingHelper/tree/st3

0 Likes

#18

I can’t get the encoding to show up in the status bar. I can see it’s set to “true” in the default settings but it doesn’t show up. I used the repository url for the ST3 branch (github.com/SublimeText/EncodingHelper.git).

Sublime Text version: 3 build 3047
EncodingHelper version: 2013.05.23.22.42.39

0 Likes

#19

I’ve had problems with this (very valuable!) plugin and the only way I got it to work with ST3 is to make some pretty significant edits to the chardet library, using http://www.diveinto.org/python3/case-study-porting-chardet-to-python-3.html and a handful of edits to EncodingHelper.py.

The only problem I am having now is that it doesn’t seem to be activated until I reload the plugin (by re-saving EncodingHelper.py) while Sublime is running. Does anyone have any idea why the plugin isn’t active unless it is reloaded?

0 Likes

#20

The branch st3 is the correct version for ST3.

0 Likes

#21

Can anyone give me a hint, how to install this under ST3 please?
I do not understand those instructions “To install for ST3, you should checkout to “st3” branch”
Thank you …

0 Likes

#22

Forgive the newbie question, but I’m using Sublime 2 and this plugin doesn’t show up in Package Control. I added the “https://github.com/SublimeText/EncodingHelper” repository using “Package Control: Add Repository” but it still doesn’t show up under “Package Control: Install Package”, even after restarting ST.

Can someone please help me install it?

Thanks.

0 Likes

#23

Can someone please help me install it?

Hello, this package does not support ST2, install ST3

0 Likes

#24

Managed to install it successfully in ST2:

Hope this helps.

0 Likes

#25

The link in the edit menu never shows. I’m using sublime text 3 in a mac. I had the packed version and the unziped versiin and neither work. what should I do?

0 Likes

#26

what should I do?
Use the status bar

Managed to install it successfully in ST2:
Nope, does not work correctly in ST2. Use ST3

0 Likes

#27

What do you mean use the status bar? could you be more specific?

0 Likes

#28

the menu is now in the status bar, click the encoding name, there is a new submenu named “Convert to UTF8 from XYZ”

0 Likes

#29

I have it installed, but it does not seem to work. I do not have the menu items and I do not have the bottom bar encoding identifier. Using ST3

0 Likes

#30

Preferences -> Settings - User

// Display file encoding in the status bar "show_encoding": true,

0 Likes

#31

I really like EncodingHelper very much.

But today I got that message of EncodingHelper saying
“Not all characters are representable in Western (ISO 8859-1), falling back to UTF-8”

IMO what EncodingHelper needs is a “best fit” mapping from characters in UTF-8 to characters in Latin-1 (ISO 8859-1).

Of course, there are many characters in UTF-8 that do not have any equivalent character in Latin-1.

But on the other hand side, there are many chararcters in UTF-8 that do have a (roughly) similar character in Latin-1, although they are not exactly the same, like e.g. all those slightly different kinds of hyphens:

‐ 8208 2010 HYPHEN
‑ 8209 2011 NON-BREAKING HYPHEN
‒ 8210 2012 FIGURE DASH
– 8211 2013 – EN DASH
— 8212 2014 — EM DASH
― 8213 2015 HORIZONTAL BAR
(Source: w3schools.com/charsets/ref_u … uation.asp )

It would be better if all of them would be mapped to the good old Latin-1 hypen (-), instead of simply doing nothing and falling back to UTF-8.

Another improvement for EncodingHelper would be if all characters that cannot be replaced during conversion at all would be marked somehow, e.g. “<?>”.

Then the user would have the possibility to manually correct them.

Please consider:

  • In most cases, there are only a few “weird” UTF-8 characters that make EncodingHelper fail and fall back to UTF-8.

  • The “weird” UTF-8 characters are often hard to recognize (see hypen example above)

See also:
stackoverflow.com/questions/231 … s-with-php - How to replace UTF-8 characters with similar-looking ASCII characters with PHP?

0 Likes

#32

For some reason I replied to preview post in another place viewtopic.php?f=3&t=16766#p73198

0 Likes