NWUnicodeToLocal

Converts a Unicode character string to local (code page based) 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) NWUnicodeToLocal ( 
      nptr                   ruleHandle,  
      pnuint8                dest,  
      size_t                 maxLen,  
      const unicode N_FAR   *src,  
      nuint8                 noMap,  
      size_t N_FAR          *len,  
      nuint32                allowNoMapFlag);
   

Pascal Syntax

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

Parameters

ruleHandle
(IN) Points to the rule table handle for Unicode-to-local conversion.
dest
(OUT) Points to the buffer for resulting character string.
maxLen
(IN) Specifies the maximum number of bytes in dest.
src
(IN) Points to the buffer containing the source Unicode.
noMap
(IN) Specifies the no map character.
len
(OUT) Points to the number of characters copied into the dest parameter (including the null byte).
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, NWUnicodeToLocal uses only the first six parameters. The seventh parameter is optionally available only for NLM applications.

On Win32 clients, this routine calls WideCharToMultiByte 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 bytes written into the output buffer and always null terminate.

If the noMap character is zero and an unmappable character is encountered, Win32 clients use the system default substitution character. Non-Win32 clients use the default character contained in the rule table. If the rule table has no default, then error code 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 NWUnicodeToLocal 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- NWUnicodeToLocal returns UNI_NO_DEFAULT any time an unmappable character is encountered.
  • USE_NOMAP_CHAR-NWUnicodeToLocal provides the default behavior of non-Win32 clients described above.

For sample code, see

See Also

NWGetUnicodeToLocalHandle, NWLocalToUnicode