Sublime Forum

EncodingHelper ( Encoding on status bar, Convert to UTF8 )

#1

Encoding Helper is a plugin which provides the following features:

  • Attempts to guess encoding of files

  • Show encoding on status bar

  • Convert to UTF-8 from a variete of encodings organized in a menu.

  • Convert to UTF-8 quickly from guessed encoding via menuitem

  • Convert to UTF-8 automatically when opening a file via some defined encodings found on User preferences

Install and read the nice formatted description here:
github.com/SublimeText/EncodingHelper#readme

NOTE: Please note that by default encoding on status bar is false. You should set the preference to true via Preferences -> Package Settings -> Encoding Helper -> …

0 Likes

Encoding questions
ConvertToUTF8 plugin
#2

Thanks for this, I working with Windows MAC and Linux files and a good encoding controll is important!

Unfortunately I have a Problem on minimized Files, for example the jew jquery “jquery-1.7.min.js” if I open it in sublime2 no encoding is shown in the status bar. Other Files work like a charm.

http://trash.ctdo.de/b/042qheie106/CUserssolarizDocumentsMy-Dr.jpg

Thanks

0 Likes

#3

Is not a problem with minimized files, is because guessing an encoding is an expensive task.
On my computer takes 8 seconds to guess the encoding for a jquery.js file.

0 Likes

#4

This packages has been updated with minor tweaks and a new feature.

Now when sublime fails to detect the encoding, the package shows for example: “ISO-8859-1, Opened as UTF-8 (document probably broken)”

Sublime text provides API call view.encoding(). There is a bug with this API. Sometimes on the “on_load” event, view.encoding() is ‘Undefined’, probably because the event is dispatched before the encoding is detected.

0 Likes

#5

Nice plugin, but looks too complex for me)
Could you please make another one with just one function - show encoding of the file in the status bar (near Syntax field)?

Thank you!

0 Likes

#6

You can just set show_encoding_on_status_bar to true and forget everything else.

0 Likes

#7

It wasn’t working for me.
I was getting this in my console:

Traceback (most recent call last): File ".\EncodingHelper.py", line 26, in <lambda> File ".\EncodingHelper.py", line 58, in on_load File ".\EncodingHelper.py", line 81, in __init__ TypeError: 'NoneType' object is not iterable
It seems that since my “fallback_encodings” list in the default settings was empty, python didn’t like it.
So I opened up the User settings file for EncodingHelper and set its contents to:

[code]{
// To show encoding on status bar
“show_encoding_on_status_bar” : true,

// Additional encodings to test when no acurrated guess can be done
// NOTE: Don't add ISO-8859-1
"fallback_encodings": "UTF-8", "ISO-8859-1", "UTF-16", "UTF-32"]

}[/code]
Now it works. Is this unexplained step expected, or did I miss something?

Thanks

0 Likes

#8

Mmm I can’t reproduce your problem. Can you please remove and reinstall the package, restart sublime to see if the problem still hapens?
Maybe there was a syntax error or something into the file you had before.

0 Likes

#9

I would love to have the same setting that the LineEndings plugin. The possibility to set:

  • Display an alert when the line_ending is not some you expect.

github.com/SublimeText/LineEndings

I started looking into doing this myself but thought it would be better putting it into this plugin.
So for example we can set a setting like:

"alert_when_encoding_is_not": "UTF-8","ISO-8859-1"]

So every time I open a file which is none of those encodings I get an alert message, would be great.

0 Likes

#10

CONVERT TO: UTF-8
I switched from Notepad++ and I really miss this vital feature in Sublime Text

just found this package
but I have 2 major issues with this ST2 package

1.] DOES IT WORK ?
how precise it is, does it work only sometimes when in official settings is this comment ?

// Automatically opens as UTF-8 the following encodings list // NOTE: Encoding detection is not acurrated // don't abuse of this feature

I do not want to abuse it I want to use it
so ok it may or may not work … which leads me to 2nd major issue

2.] CONVERT IT, no more
is there anywhere manual action simply and only … Convert to UTF-8 ?
it is real pain to look at 100+ encodings in the menu and do not know how to just convert
I believe I am not the only one who does not know file encoding and does not really care as long as it can be unified into UTF-8
is there any feature like this ?

correct me if I am wrong or using it stupid on my side
but so far the only thing the plugin does by default is that it shows the encoding in status bar

shoot me, help me, anything, thanks

0 Likes

#11
  1. yes and no.

To convert a document from some encoding to the other, go to “edit” -> “Convert to uft8 from” and select the encoding.

The plugins tries to guess the encoding and on the menu will show “convert to uft8 from guessed$here”

0 Likes

#12

look at the screenshot!

0 Likes

#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