Friday, April 5, 2019

Can a UNC Network Share be Unicode

Well the answer is partially, but the formal documents say otherwise and are incorrect.

Given a UNC Path is represented as

"\\" host-name "\" share-name  [ "\" object-name ]

host-name must be a NetBIOS computer name according to

https://support.microsoft.com/en-us/help/909264/naming-conventions-in-active-directory-for-computers-domains-sites-and


however, the share-name can be Unicode

An lastly, the object-name can be Unicode and is widely understood.

object-name = *path-name [ "\" file-name ]


Example : \\centos7\Ȧunicode\build

Here's the UNC Path Specification from Microsoft
https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-dtyp/62e862f4-2a51-452e-8eeb-dc4ff5ee33cc


The filespace selector is a null-terminated Unicode character string in the following ABNF syntax:


  •  UNC                = "\\" host-name "\" share-name  [ "\" object-name ]
  •  host-name          = "[" IPv6address "]" / IPv4address / reg-name  
  •     ; IPv6address, IPv4address, and reg-name as specified in [RFC3986] 
  •  share-name         = 1*80pchar
  •  pchar              = %x20-21 / %x23-29 / %x2D-2E / %x30-39 / %x40-5A / %x5E-7B / %x7D-FF  
  •  object-name        = *path-name [ "\" file-name ]
  •  path-name          = 1*255pchar
  •  file-name          = 1*255fchar [ ":" stream-name [ ":" stream-type ] ]
  •  fchar              = %x20-21 / %x23-29 / %x2B-2E / %x30-39 / %x3B / %x3D / %x40-5B / %x5D-7B / %x7D-FF 
  •  stream-name        = *schar
  •  schar              = %x01-2E / %x30-39 / %x3B-5B /%x5D-FF
  •  stream-type        = 1*schar
where Augmented Backus–Naur Form (ABNF) is a metalanguage based on Backus–Naur form (BNF), but consisting of its own syntax and derivation rules.

But 
  •  share-name         = 1*80pchar
pchar is defined as a pointer to a CHAR, which is ANSI

But share-name can be UNICODE therefore; 

  •  share-name         = 1*80pcwstr 
pcwstr (A pointer to a constant null-terminated string of 16-bit Unicode characters)

How to set an Unicode Net Share?

Remember in CMD Window set code page first to 

chcp 65001

which will change the code page to UTF-8. Also, you need to use Lucida console fonts in CMD Window.




No comments:

Post a Comment