Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

k2spitfire88

macrumors 6502
Original poster
Feb 15, 2008
422
0
in your mind
I'm using my work mac, and trying to write some scripts for Windows to use, particularly using diskpart in the Win PE Command prompt. The issue I am running into, is diskpart (from what I've read) doesn't like the "Unicode" encoding that Text Edit likes to use. It needs ANSI, I believe. Does anyone know of any text editor for Mac that allows you to use ANSI encoding? I could use Windows, but I would prefer not to switch machines or fire up parallels every time I need to do some scripting...

Thanks for your help! (I'm new to the scripting game, so if I'm not making any sense, just let me know, and I will do my best to clarify).
 
Last edited:

gnasher729

Suspended
Nov 25, 2005
17,980
5,565
I'm using my work mac, and trying to write some scripts for Windows to use, particularly using diskpart in the Win PE Command prompt. The issue I am running into, is diskpart (from what I've read) doesn't like the "Unicode" encoding that Text Edit likes to use. It needs ANSI, I believe. Does anyone know of any text editor for Mac that allows you to use ANSI encoding? I could use Windows, but I would prefer not to switch machines or fire up parallels every time I need to do some scripting...

Thanks for your help! (I'm new to the scripting game, so if I'm not making any sense, just let me know, and I will do my best to clarify).

Use TextEdit, switch to "Plain Text", and in the "Save" dialog you can choose the encoding. (Look for "Western" + "Windows").
 

bredell

macrumors regular
Mar 30, 2008
127
1
Uppsala, Sweden
TextEdit supports a large number of text encodings. After you've started TextEdit, choose the menu "Format > Make Plain Text". Then, when you choose "Save As" you can select the encoding you want. If the encoding you want is not in the list, choose "Customize Encodings List" and select the one you want.

If you're only using standard english characters you can probably use the encoding "Western (Windows Latin 1)". If that doesn't work, try the encoding "Latin-US (DOS)".
 
  • Like
Reactions: karinanishimura

k2spitfire88

macrumors 6502
Original poster
Feb 15, 2008
422
0
in your mind
Thanks for your help guys, but it doesn't appear to be working. I may be doing something wrong with the script itself, but I'm not sure, seeing as I know very little about it. I guess I'll try writing it from Windows and going from there.
 

k2spitfire88

macrumors 6502
Original poster
Feb 15, 2008
422
0
in your mind
I figured out why it wasn't working, and boy do I feel dumb now...

In diskpart, to use a script, you type in diskpart /s < scriptname>.txt
and it runs the script.

I had the diskpart command in the beginning of the script. Deleted it and it ran fine! Thanks again!
 

Guiyon

macrumors 6502a
Mar 19, 2008
771
4
Cambridge, MA
If you are moving between Mac OS X and Windows, another thing to watch for is newlines. In Windows CRLF is used as the newline 'character' and in Mac OS X LF is used as a newline. Some Windows apps/tools don't respond well to text files that use LF instead of CRLF (notepad immediately comes to mind).
 

k2spitfire88

macrumors 6502
Original poster
Feb 15, 2008
422
0
in your mind
If you are moving between Mac OS X and Windows, another thing to watch for is newlines. In Windows CRLF is used as the newline 'character' and in Mac OS X LF is used as a newline. Some Windows apps/tools don't respond well to text files that use LF instead of CRLF (notepad immediately comes to mind).

Thanks for the info. I had seen that also, so I'm using Textwrangler, and using the CRLF option for line breaks. Hopefully that helps.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.