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.

I just edited a .html file using Adobe Dreamweaver, the charset is gb2312 since it's a Chinese website, then I used TextMate to edit the file, after I save the file, it was changed into utf-8 since the version of TextMate I'm using doesn't support Chinese. Is there any way I change the charset back to gb2312?

share|improve this question

migrated from stackoverflow.com Mar 18 '13 at 3:41

This question came from our site for professional and enthusiast programmers.

    
try iconv fileformat.info/tip/linux/iconv.htm –  btevfik Mar 17 '13 at 7:50
add comment

1 Answer

up vote 0 down vote accepted

You can use Utilities -> Terminal and then sudo -s then Use the following command

iconv -f UTF-8 -t GB2312 oldfile.html > newfile.html

Change the charset in command accordingly.

OR

Mac has a file version system like TimeMachine. You can browse the previous versions of the file. See if mac saved the previous version of your file.

share|improve this answer
    
actually iconv doesn't support GB-2312, and I didn't set up Time Machine. But thanks a lot! –  vvv214 Mar 18 '13 at 1:07
    
@vvv214 iconv -l includes GB2312, but you could also try brew install recode; recode utf8..gb2312 input.txt. –  Lri Mar 18 '13 at 8:19
add comment

Your Answer

 
discard

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