Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 ANSI because that includes more characters that are not supported.

Thanks

share|improve this question
1  
7-bit ASCII has no support for "weird characters". So you want to just remove them from the file? If so, open with any 8 bit encoding and search for regular expression [\x80-\xff], replacing it with nothing. –  Daniel Beck Jan 16 '13 at 15:32

1 Answer 1

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. http://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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.