Unicode Support in OpenLDAP for Windows
OpenLDAP for Windows is completely Unicode-aware so you can use its client tools with various international languages. For example, you can use the ldapsearch utility to return all entries that meet your filter criteria specified as a Unicode string:
ldapsearch.exe -x -b "dc=maxcrc,dc=com" "(cn=أبو نواس)" *
This article first highlights how to display Unicode characters in the Windows console. It then describes what exactly makes OpenLDAP for Windows Unicode ready.
Displaying Unicode Characters in a Command Window
Every OpenLDAP client tool is a console application, which means that in most cases you interact with it through a command window, i.e. cmd.exe. When working with a command window, you may encounter a situation where some or all letters of a particular language (e.g. Arabic) are displayed as boxes instead of letters. The reason can be that the current font of the command window does not support the language characters you expect to see on the screen. For instance, you can see that with the Lucida Console font, the Arabic text هذا النص هي اللغة العربية (translated as “This text is Arabic”) is displayed as a bunch of boxes.
You can resolve that by using a Unicode font that includes the missing characters. Such a font should be installed to the Windows and added to the list of fonts available to a command window. Note that not all fonts can be used with a command window. You can learn about criteria the font should meet as well find out how to add such a font to the window from this Microsoft article: Necessary criteria for fonts to be available in a command window (Q247815).
For illustration purposes, we included a monospace version of the well-know free and open source font DejaVu in the installer of OpenLDAP for Windows. The font (DejaVu Sans Mono) featuring a great number of Unicode characters is compatible with a command window. If you selected the font when installing OpenLDAP for Windows, it will be installed to your Windows and integrated with the command window. After that, you can select DejaVu Sans Mono in the list of fonts available in the properties of the command window.
After setting DejaVu Sans Mono as the current font, the uniform boxes become Arabic letters.
You can make the font persistent for your command window by clicking Defaults in the window’s system menu.
Unicode Command-Line Parameters
You can use Unicode for command-line parameters when using OpenLDAP client tools. For example, you can set a Unicode string for the attribute value in a search filter:
ldapsearch.exe -x -b "dc=maxcrc,dc=com" "(cn=أبو نواس)" *
Unicode Console Input
OpenLDAP client tools when run with or without certain parameters prompt you to input data interactively. For instance, you specify –W to tell the tool that you want to enter the password for the bind DN through a command prompt. The input text can be Unicode.
Unicode Console Output
The results of OpenLDAP tools output in the command Window are in Unicode.
If you start the server instance (slapd.exe) in console mode, you will see that the log messages also have Unicode output.
Unicode Input Streams
OpenLDAP client tools allow you to read the value of a command-line parameter from a file rather than set it in the command line or enter it after the command tool starts. For instance, when using the ldapmodify utility, you can specify the path to a LDIF file in the parameter –f. OpenLDAP for Windows supports reading from UTF-8 files both with and without BOM (the byte mark order).
The OpenLDAP configuration file (slapd.conf) can be encoded as UTF-8. For example, this may be helpful when you need to configure ACLs.
Finally the standard input redirection (i.e., the less-than sign) is also UF-8 enabled.
Unicode Output Streams
The standard output redirection (i.e., the greater-than sign) is UTF-8 enabled. This allows you to redirect the output from client tools to LDIF files.