NWLocalToUnicode

Converts a local (code page based) character string to a Unicode character string

Local Servers:nonblocking
Remote Servers:N/A
NetWare Server:4.x, 5.x, 6.x
Platform:NLM, Windows NT, Windows95, Windows 98
Library:Cross-Platform Localization (LOC*.*)
Service:Unicode

Syntax

   #include <unicode.h> 
    
   N_EXTERN_LIBRARY(nint) NWLocalToUnicode ( 
      nptr               ruleHandle,  
      punicode           dest,  
      nuint32            maxLen,  
      const void N_FAR  *src,  
      unicode            noMap,  
      pnuint             len,  
      nuint32            allowNoMapFlag);
   

Pascal Syntax

   uses netwin32 
    
   Function NWLocalToUnicode 
     (ruleHandle : nptr;              
      dest : punicode;           
      maxLen : nuint32;           
      src : nptr;           
      noMap : unicode;            
      len : pnuint; 
      allowNoMapFlag : nuint32 (*optional, available on NLM only*) );
   

Parameters

ruleHandle
(IN) Points to the rule table handle for local to Unicode conversion as initialized by NWGetLocalToUnicodeHandle.
dest
(OUT) Points to the buffer for storing the resulting Unicode string.
maxLen
(IN) Specifies the maximum number of Unicode characters in the dest parameter (each unicode character is 2 bytes).
src
(IN) Points to the source-local character string.
noMap
(IN) Specifies the no map character.
len
(OUT) Points to the number of characters copied into the dest parameter (including the 2-byte null termination character).
allowNoMapFlag
(IN) (Optional, available only on NLM) Specifies whether to replace an unmappable character or simply return an error. (See explanation in "Remarks" below.)

Return Values

These are common return values; see Return Values (Return Values for C) for more information.

0x0000

Successful

0xFE10

UNI_HANDLE_BAD

0xFE0D

UNI_NO_DEFAULT

0xFE0E

UNI_RULES_CORRUPT

0xFE0F

UNI_HANDLE_MISMATCH

Remarks

For cross-platform operations, NWLocalToUnicode uses only the first six parameters. The seventh parameter is optionally available only for NLM applications.

On Win32 clients, this routine calls MultiByteToWideChar which results in some differences from other platforms. If there is insufficient space in the output buffer, Win32 clients set len to zero, and do not null terminate the buffer. Non-Win32 clients always return the number of unicode characters written into the output buffer and always null terminate.

If an input character is unmappable, Win32 clients use a default substitute character, not the noMap character. On non-Win32 clients, an unmappable character is replaced by the noMap character. If the noMap character is zero, it uses the default character contained in the rule table. If the rule table has no default, UNI_NO_DEFAULT is returned.

The allowNoMapFlag parameter provides another optional behavior, but only for the NLM platform (N_PLAT_NLM must be defined). By default, on NLM applications NWLocalToUnicode handles unmappable characters in the same way as non-Win32 clients described above. To specify behavior explicitly, define EXCLUDE_UNICODE_NLM_COMPATIBILITY_MACROS and pass one of the following values for allowNoMapFlag:

  • DONT_USE_NOMAP_CHAR- NWLocalToUnicode returns UNI_NO_DEFAULT any time an unmappable character is encountered.
  • USE_NOMAP_CHAR-NWLocalToUnicode provides the default behavior of non-Win32 clients described above.

For examples, see

See Also

NWGetLocalToUnicodeHandle, NWUnicodeToLocal