Monday, February 7, 2011

Cygwin: Setting up the environment and locale

When using Cygwin to connect to linux servers, and when using Cygwin in a windows environment in general, it is important to get the locale right.

I am using Cywin through cmd-sessions, and I load Cygwin manually for each cmd-prompt session, as I do not want to override the Windows/Dos commands by default.
Thus I run the file loadcygwin.cmd each time I want to switch to/load Cygwin.
The content of loadcygwin.cmd is listed below:

loadcygwin.cmd:

@echo off
call setcygwinenvironment.cmd
:: WinXp
set path=c:\Program Files\CygWin\bin;%path%
::Win7
::set path=C:\Program Files (x86)\cygwin\bin;%path%
echo Cygwin now loaded.

In this file I am calling the script setcygwinenvironment.cmd which sets the locale. (As you can see I am living in Denmark, which my locale settings reflect)

setcygwinenvironment.cmd:

echo Setting up CYGWIN environment...

:: Set cygwin locale to the same as windows locale.
set LANG=da_DK-UTF-8
set LC_CTYPE=da_DK.UTF-8
set LC_NUMERIC=da_DK.UTF-8
set LC_TIME=da_DK.UTF-8
set LC_COLLATE=da_DK.UTF-8
set LC_MONETARY=da_DK.UTF-8
set LC_MESSAGES=da_DK.UTF-8
set LC_ALL=da_DK
set CYGWIN=acl nodosfilewarning
echo done.

No comments:

Post a Comment