WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: JTaylor on August 05, 2015, 09:33:10 AM

Title: Substitution Does Not Handle Unicode
Post by: JTaylor on August 05, 2015, 09:33:10 AM
It appears that  "%Substitution%" does not handle Unicode.  Could that be fixed soon?

Jim
Title: Re: Substitution Does Not Handle Unicode
Post by: td on August 05, 2015, 01:17:52 PM
The fix is not to use substitution.
Title: Re: Substitution Does Not Handle Unicode
Post by: JTaylor on August 05, 2015, 01:22:13 PM
I take that as a "No"?   Hadn't thought of that as a reply to my users whenever something doesn't work in my applications...maybe I'll give it a try myself  ;)

Jim
Title: Re: Substitution Does Not Handle Unicode
Post by: td on August 05, 2015, 03:52:54 PM
If by handling you mean you variables containing a Unicode string, WIL substitution handles them by converting the string to the current Windows code page.   This is the only thing it can do given that WIL scripts are always ANSI text.   So this bit of functionality isn't going to change.
Title: Re: Substitution Does Not Handle Unicode
Post by: JTaylor on August 05, 2015, 04:14:25 PM
Okay.  That  is all I needed to know.

Jim
Title: Re: Substitution Does Not Handle Unicode
Post by: DAG_P6 on August 06, 2015, 11:32:04 PM
Quote from: td on August 05, 2015, 03:52:54 PM
If by handling you mean you variables containing a Unicode string, WIL substitution handles them by converting the string to the current Windows code page.   This is the only thing it can do given that WIL scripts are always ANSI text.   So this bit of functionality isn't going to change.

Besides that, StrReplace can do anything that substitution can do, only much more safely.
Title: Re: Substitution Does Not Handle Unicode
Post by: JTaylor on August 07, 2015, 07:50:57 AM
I mainly use Substitution for dynamic variable creation which saves me thousands of lines of code and in the formation of SQL scripts where that are LOTS of quotes involved and adding more makes reading/debugging SQL much more difficult.  Can't see how StrReplace() can do either of those things.

Jim
Title: Re: Substitution Does Not Handle Unicode
Post by: DAG_P6 on August 10, 2015, 10:32:47 AM
Quote from: JTaylor on August 07, 2015, 07:50:57 AM
I mainly use Substitution for dynamic variable creation which saves me thousands of lines of code and in the formation of SQL scripts where that are LOTS of quotes involved and adding more makes reading/debugging SQL much more difficult.  Can't see how StrReplace() can do either of those things.

Jim

When I need "dynamic" variables, I usually use an array of some kind, or a hash table of some sort (Scripting.Dictionary, and its cousins).
Title: Re: Substitution Does Not Handle Unicode
Post by: JTaylor on August 10, 2015, 10:55:58 AM
For one of my applications I store my variables/values in a database and with a few lines of code I can retrieve/save/sync all of variables for all of the users.

Jim