www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Unicode validation for Posix

reply Vino <akashvino79 gmail.com> writes:
Hi All,

     As per the documentation from std.process it states that an 
exception is thrown if the variable contains invalid UTF-16 
characters and it can also be validated using "validate" function 
from std.utf, so the question is do we have a similar one for 
Posix as this seem to be applicable only to Windows.

```
Exception if the environment variable does not exist, or 
std.utf.UTFException if the variable contains invalid UTF-16 
characters (Windows only).
```

From,
Vino
Sep 03 2023
parent Paul Backus <snarwin gmail.com> writes:
On Sunday, 3 September 2023 at 10:06:58 UTC, Vino wrote:
 Hi All,

     As per the documentation from std.process it states that an 
 exception is thrown if the variable contains invalid UTF-16 
 characters and it can also be validated using "validate" 
 function from std.utf, so the question is do we have a similar 
 one for Posix as this seem to be applicable only to Windows.

 ```
 Exception if the environment variable does not exist, or 
 std.utf.UTFException if the variable contains invalid UTF-16 
 characters (Windows only).
 ```

 From,
 Vino
On POSIX, no validation is necessary, because the names of environment variables are allowed to contain any character except for `\0` (including invalid Unicode).
Sep 03 2023