<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >Locale-based character encoding</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="The Hugs 98 User's Guide" HREF="index.html"><LINK REL="UP" TITLE="Changing the behaviour of Hugs" HREF="options.html"><LINK REL="PREVIOUS" TITLE="Environment variables used by Hugs" HREF="environment-variables.html"><LINK REL="NEXT" TITLE="Adding packages to a Hugs installation" HREF="packages.html"><LINK REL="STYLESHEET" TYPE="text/css" HREF="hugs-ug.css"></HEAD ><BODY CLASS="SECT1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >The Hugs 98 User's Guide</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="environment-variables.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Chapter 3. Changing the behaviour of Hugs</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="packages.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="LOCALE" >3.3. Locale-based character encoding</A ></H1 ><P >The Haskell 98 Report defines values of the <TT CLASS="LITERAL" >Char</TT > type as the code points of Unicode (or equivalently ISO/IEC 10646). However files and other I/O streams typically consist of bytes, with characters in text files encoded as one or more bytes. In many systems, a similar encoding is also required for interactions with the system. Therefore at these points Hugs converts characters to and from sequences of bytes in a manner determined by the <TT CLASS="LITERAL" >LC_CTYPE</TT > category of the current <SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >locale</I ></SPAN >.</P ><P >This conversion is not applied to the contents of files opened in binary mode. It is applied to program text, so you can use all the characters representable in your locale within comments and string literals. However only ISO Latin-1 characters are permitted in identifiers.</P ><P >The form of the locale string, and how it is set, vary between systems.</P ><P ></P ><UL ><LI ><P >On POSIX systems, this value is taken from the first nonempty environment variable from <CODE CLASS="ENVAR" >LC_ALL</CODE >, <CODE CLASS="ENVAR" >LC_CTYPE</CODE > and <CODE CLASS="ENVAR" >LANG</CODE >.</P ></LI ><LI ><P >On Windows, this value is the <SPAN CLASS="QUOTE" >"user-default ANSI code page"</SPAN > (not the <SPAN CLASS="QUOTE" >"current OEM code page"</SPAN > or the <SPAN CLASS="QUOTE" >"ANSI code page"</SPAN >). This may be set using the General tab of the <SPAN CLASS="QUOTE" >"Regional Options"</SPAN > control panel.</P ></LI ></UL ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="environment-variables.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="packages.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Environment variables used by Hugs</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="options.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Adding packages to a Hugs installation</TD ></TR ></TABLE ></DIV ></BODY ></HTML >