--- In [email protected], "entropyreduction" 
<alancampbelllists+ya...@...> wrote:
>
> --- In [email protected], "Sheri" <sherip99@> wrote:
> >
> > --- In [email protected], "entropyreduction" 
> > <alancampbelllists+yahoo@> wrote:
> > >
> > > I could easy add config ini keys checkForUnicodeArgs,
> > > checkForUnicodeResult. All or nothing, either checking happens or
> > > it doesn't (obviously if I can;t locate unicode plugin, checking
> > > never happens).
>  
> > I suppose ini could house defaults, although personally I think
> > default should always be ANSI. 
>
> You mean default should be "never check for unicode handles" and
> "never attempt to translate result strings with chars > 255 into
> a stored unicode string"?

No I meant the default-default would be "never check for unicode handles" and 
"never return unicode handles" 

> > But in scripts we could do something like:
> > 
> > e.g., com.returnUnicodestrings(1) and com.returnUnicodestrings(0)
> 
> Two separate issues, maybe handles with three levels:
> 
>   com.handleUnicode(0) ;; do nada
> 
> ; check for unicode stringn handles in args, but never produce
> ; a unicode handle  
>   com.handleUnicode(1) 
> 
> ; check for unicode stringn handles in args, produce
> ; unicode handles if output strign contains chars > 255 
>   com.handleUnicode(2) 
> 
> or could be done with two separate services
> 
>   com.returnUnicodeHandles
>   com.checkForUnicodeHandles
> 
> > and similar for enabling/disabling checking for unicode args. I
> > no longer think you should "check" for unicode results char>255.
> > If the script wants to treat the returned string as unicode, it
> > should be possible to do so (regardless if only low value
> > characters are used). 
>
> ???? Don't follow. When I convert a BSTR (aka WCHAR*) to ANSI
> with WideCharToMultiByte, any WCHAR that won't fit in a CHAR (8
> bits, max 0xFF) is lost. If you want to keep such high values,
> gotta use a unicode string, and return a handle. 

Normally a substitute character is used during conversion, e.g., a question 
mark.

The way you have proposed to do it (strings are returned as ANSI except when 
the content has high value characters), any script that enables unicode 
return-strings would need to test the content of each returned string to see if 
it looks like "u\x53nnn". If the script wants to handle unicode, why not let it 
declare that's what it wants and let it handle even low value characters as 
unicode? Otherwise the same function called in a loop sometimes returns a 
unicode handle and sometimes not!

> 
> > Also I don't think com should automatically load the unicode
> > plugin. If the user wants to load the unicode plugin, it is
> > easily done, e.g., with unicode.version. If
> > com.returnUnicodestrings(1) and unicode is not already loaded,
> > generate an error. (I seem to remember Bruce added something that
> > makes it possible to test if a plugin is loaded). If unicode is
> > not loaded, and checking for unicode arguments is enabled,
> > arguments cannot really be in unicode; just send the strings.
> 
> Will continue to load unicode plugin, unless user has indicated
> no interest by calls to com.ReturnUnicodeHandles(0) and
> com.CheckForUnicodeHandles(0), or equivalent config ini keys.
>

I think zeros should be the defaults, because as noted above I think if the 
script is handling certain return strings as unicode, it will want all those 
strings to be unicode.

There could even be existing working scripts that stop running, because it used 
to get a normal string (maybe with a question mark in it) but after update 
starts getting "u/x53nnn" instead.

Regards,
Sheri

Reply via email to