Fun with NLS on Windows

Help
2004-12-20
2013-04-25
  • Dominic Smith
    Dominic Smith
    2004-12-20

    I pretty much know the answer, but I feel it is worth asking. Does pdcurses have the ability to handle NLS character conversion?

    Essentially, I'm looking at an application written with the assumption of ISO 8859-1 (it uses german characters), but also uses a lot of box drawing (ie, graphical mode).

    If using the default codepage on Windows, the box drawing is fine, but the NLS characters are mashed (since the codeset just doesn't match up). Conversely, if I use codepage 28591, the NLS chars are fine, but the graphical mode is non-existant (unsurprisingly, since the line drawing characters exist nowhere within this charset).

    So, what can be done? In real terms, re-writing the application (and a live database) to work with the 1252 codepage is out of the question. I could create my own character conversion filter to deal with the damage before it hits curses, and after curses hands it back - I just wondered if there was anything already available within pdcurses? :)

     
    • Character set conversion per se is outside the scope of PDCurses; for that, you want something like libiconv. However, in CVS now is preliminary Unicode support (for Win32 NT family and X11 only). That could make your app work with no additional effort, since the first 256 characters of Unicode are essentially ISO 8859-1, and the box-drawing characters are defined in Unicode terms in that mode. You just have to build both the library and the app with "PDC_WIDE" defined.