Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.4: Character conversion with textutil UNIX
Everyt ime I have come across hints about textutil, I have tried to use it for converting text files between different character encodings.

According to the documentation, textutil should be perfect for this. However, it has never worked. Until now. It seems like the -format and -convert flags must be specified, too. This example converts a macroman encoded file to latin-1:
textutil -format txt -inputencoding macintosh -convert txt \
 -encoding iso-8859-1 mytextfile.txt
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[8,166 views]  

10.4: Character conversion with textutil | 3 comments | Create New Account
Click here to return to the '10.4: Character conversion with textutil' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Character conversion with textutil
Authored by: fds on Mar 16, '06 10:58:43AM

If they are both plain text files, it's probably simpler to just use iconv:

iconv -f mac -t iso-8859-1 mytextfile.txt



[ Reply to This | # ]
10.4: Character conversion with textutil
Authored by: Kosice on Mar 16, '06 12:49:02PM

Could one of the great reader of this news use this info to create a script that would unzip .zip file from windows while converting file names from latin-1 to macroman?

thanks



[ Reply to This | # ]
10.4: Character conversion with textutil
Authored by: fitzgunnar on Mar 17, '06 01:24:28AM

Great! I had missed that one completely.

/MagnusG!



[ Reply to This | # ]