From NetHackWiki
Revision as of 01:36, 21 December 2023 by Ray Chason (talk | contribs) (Update link to patch)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
W343-3 designates a bug that affects the Microsoft Windows version of NetHack 3.4.3. It is fixed in NetHack 3.6.0. The bug is listed as:

Under the Polish version of Windows 2000 SP4, screen output with a raster font shows wrong characters for many dungeon features

Win32 locales fix
Author Ray Chason
Download link
NetHack PatchDB 313

Nature of the bug

The bug has been reported on Polish and Russian editions of Windows 2000 and on a Czech version of Windows XP. It has been duplicated on an American Windows XP by changing a language setting. A screenshot is available.

Bug W343-3 really comprises two distinct and unrelated bugs. One is a simple character set issue: many non-USA PCs are configured with different character sets, and seven symbols may look different. This issue is more fully detailed in the IBMgraphics article.

The more serious bug is that some characters appear as strange symbols or blank squares. This is not actually a bug in NetHack, but in Windows. The rest of this article will deal with this bug.

Cause of the bug

The bug is a flaw in the Windows WriteConsoleOutputCharacterA API. When its configured code page is other than 437 or 850, many non-ASCII characters can show up incorrectly.

The bug occurs when four conditions are met:

  • The version of Windows is Windows NT or one of its descendants, no later than Windows 8.1. The bug is confirmed to exist on Windows 2000, Windows XP, Windows Vista, Windows 7, Windows 8 and Windows 8.1. It is confirmed to be fixed on Windows 10 (but see the note below on Windows 10).
  • The built-in command shell window is used. Alternate command shell windows are available; Cmder, in particular, is confirmed not to have the bug.
  • A bitmap font, rather than Lucida Console, is selected.
  • The command shell is running in a window, rather than full screen. Windows Vista and later do not support full screen mode in the console, and so this item will always be true for those versions of Windows.
  • The language for non-Unicode programs is set to one whose OEM code page is anything other than 437 or 850. Basically this means any East European language, whether it uses Greek, Cyrillic or Latin writing.

No API other than WriteConsoleOutputCharacterA is known to be affected. In particular, the Unicode variant WriteConsoleOutputCharacterW works correctly.

Windows 10

The Windows terminal program changed in Windows 10. The changed fixed the original W343-3 problem, but certain characters on the Rogue level may not display correctly. Specifically, the characters that have code points less than 0x20 display as empty boxes. See IBMgraphics for more details.

This bug appears when the terminal program is not in legacy mode and when a TrueType font is selected.

This bug is only loosely related to W343-3, but the fix in the code is the same. All users of Windows 10 running NetHack 3.4.3, regardless of locale, can benefit from the W343-3 patch.

Versions affected

NetHack 3.4.3 is known to have this bug. Because NetHack 3.1.1 through 3.1.3 also use the flawed API, it is likely that they have it as well. NetHack 3.2.0 through 3.4.2 use different APIs, and do not have this bug.

The Curses interface is not affected, even when linked with PDCurses for the Win32 console, because PDCurses does not uses the offending API.


The bug is fixed in NetHack 3.6.0. A patch is available to fix this bug in NetHack 3.4.3; but no binaries or variants other than Spanish NetHack are known to incorporate it.

The patch fixes the API issue by detecting when it is running on an NT-based version of Windows, and using the Unicode API instead, avoiding the Windows bug. It fixes the character set issue as well (see IBMgraphics) by allowing less-extensive variants of IBMgraphics to be set, avoiding the characters that can vary among code pages.

The patch was posted to rec.games.roguelike.nethack as four articles:

  • Part 1 describes the API issue and provides detailed instructions to duplicate it, and a small test program to demonstrate the bug.
  • Part 2 describes the character set issue.
  • Part 3 contains the patch itself.
  • Part 4 is a description of each change the patch makes.

The NetHack Patch Database has a simpler form of this patch, that works around the faulty API but does not alter the IBMgraphics, here. This patch also fixes W343-4.