Hi,
I'm trying to use iconv to convert a Shift-JIS document to UTF-8. It's successful in Terminal, but not so in TextMate.
The command I use in Terminal is:
iconv -f shift-jis -t utf-8 text1.txt>text2.txt
This converts the file successfully.
In TextMate, I set up a command, using:
iconv -f shift-jis -t utf-8 "$TM_FILEPATH"
in Command(s) field. I set Save: Nothing Input: None Output: Replace Document
Activation and Scope Selector are unset. After using this command, I see a diamond-like character at the end of each line.
Any help would be appreciated.
Takaaki
Takaaki-san,
On 24.07.2007, at 12:16, Takaaki Kato wrote:
Hi,
I'm trying to use iconv to convert a Shift-JIS document to UTF-8. It's successful in Terminal, but not so in TextMate.
The command I use in Terminal is:
iconv -f shift-jis -t utf-8 text1.txt>text2.txt
This converts the file successfully.
In TextMate, I set up a command, using:
iconv -f shift-jis -t utf-8 "$TM_FILEPATH"
in Command(s) field. I set Save: Nothing Input: None Output: Replace Document
This doesn't work because the cryptic text in TM's window is utf-8 now! There are dozens of ways.
one would be to write in a new TM window:
iconv -f shift-jis -t utf-8 /PATH/TO/file.txt | cat
and press CTRL+R
Hans
An other way is to use the attached bundle.
I wrote it some time ago. Simply press APPLE+SHIFT+O to invoke it. You can browse for a file, set the file's encoding, the output format, etc. You can edit icf.plist to add more encodings. The whole bundle is working with 'iconv' and 'textutil' - see man pages for more details.
You also can drag&drop a file from the Finder to an empty TM window. This also will invoke that dialog.
Cheers,
Hans
On Jul 24, 2007, at 7:39 PM, Hans-Jörg Bibiko wrote:
This doesn't work because the cryptic text in TM's window is utf-8 now! There are dozens of ways.
Thanks, Hans. I'll try your way. Is there any way to set up a command of TextMate, possibly using iconv or nkf (http://en.wikipedia.org/ wiki/NKF_Japanese_Encoder)?
Oh, I found a command called "Remove Unprintable Characters in Document / Selection" in Text Bundle. This may solve my problem.
Your suggestion needs a path to the file. I don't think there's a quick way to enter the path to the file. I may be missing.
Anyway, thanks a lot.
Takaaki
Takaaki-san,
Your suggestion needs a path to the file. I don't think there's a quick way to enter the path to the file. I may be missing.
If you don't want to use the OpenEncodeFile.tmBundle you can enter such paths with the attached tmCommand.
Simply write ~/De
and press OPTION+APPLE+TAB.
See a Screenmovie of it here:
http://www.bibiko.de/TM_InsertFilePathNames.mov
Please note: I changed the key binding to OPTION+APPLE+TAB!
dewa mata,
Hans
On Jul 24, 2007, at 8:10 PM, Hans-Jörg Bibiko wrote:
If you don't want to use the OpenEncodeFile.tmBundle you can enter such paths with the attached tmCommand.
Thanks. Both of your bundles seem very helpful. I will try your way. I'm not as much of a hacker as you are :) I need some time :)
Ja mata.
Takaaki