www.delorie.com/gnu/docs/glibc/libc_104.html   search  
 
Buy the book!


The GNU C Library

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.5.4.1 Format of `gconv-modules' files

All information about the available conversions comes from a file named `gconv-modules', which can be found in any of the directories along the GCONV_PATH. The `gconv-modules' files are line-oriented text files, where each of the lines has one of the following formats:

Returning to the example above where one has written a module to directly convert from ISO-2022-JP to EUC-JP and back. All that has to be done is to put the new module, let its name be ISO2022JP-EUCJP.so, in a directory and add a file `gconv-modules' with the following content in the same directory:

 
module  ISO-2022-JP//   EUC-JP//        ISO2022JP-EUCJP    1
module  EUC-JP//        ISO-2022-JP//   ISO2022JP-EUCJP    1

To see why this is sufficient, it is necessary to understand how the conversion used by iconv (and described in the descriptor) is selected. The approach to this problem is quite simple.

At the first call of the iconv_open function the program reads all available `gconv-modules' files and builds up two tables: one containing all the known aliases and another that contains the information about the conversions and which shared object implements them.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003