Convert text file to ASCII, nothing more, in Sublime Text

asciicharacter encodingfile conversionsublime-text-2text-editors

We have a project where we need to convert weird characters generated from all kinds of file formats into ASCII due to compatibility issues. Is it possible in Sublime Text 2 to convert the encoding of a document to ASCII? We can't convert it to any extended/non-ASCII character set if it includes more characters that are not supported.

Best Answer

Sublime text 2 will allow you to save with a variety of encodings, but won't do so if you have characters that don't fit in the encoding you are saving to. I had a problem recently were I was getting encoding errors at various positions in Mako templates and since the characters were not displayable in sublime text I couldn't even see them to remove them. So I opened the file in the hex editor HxD changed the offset base to decimal and went straight to the positions specified in the errors and removed the offending characters; Problem solved.

Also it didn't help me in this case but you might find this useful. https://stackoverflow.com/questions/12943594/is-it-possible-to-show-the-exact-position-in-sublime-text-2 The link above includes source that if saved to Preferences > Browse Packages > User will add absolute position of the cursor to the status line at the bottom of the Sublime Text window, though this didn't help me since the offending characters weren't displayable.

Related Question