Text output in ANSI/ASCII instead of Unicode

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 16 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
DiZzyDmon
Posts: 73
Last visit: Thu Feb 29, 2024 8:01 am
Has voted: 1 time

Text output in ANSI/ASCII instead of Unicode

Post by DiZzyDmon »


I just upgraded to the latest point release of PrimalScript (4.1.540) and, once again after an update, VBScripts I run output text results as Unicode instead of ANSI.
Subsequent VBScripts that process this output cannot read Unicode. The last time this happened I figured out how to reset PrimalScript to output text as ANSI, but I've forgotten how and can't find it in the program's Help feature.
User avatar
donj
Posts: 416
Last visit: Thu May 29, 2008 5:08 am

Text output in ANSI/ASCII instead of Unicode

Post by donj »

I wasn't even aware this was possible! Not saying it isn't, just that I thought VBScript's FileSystemObject always defaulted to a particular setting - and PrimalScript certainly wouldn't be changing that. Or are you not using the FileSystemObject to produce output?
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Text output in ANSI/ASCII instead of Unicode

Post by Alexander Riedel »

PrimalScript does not change the output of VBScript. Maybe you are opening a file that already is Unicode?

Alex
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Text output in ANSI/ASCII instead of Unicode

Post by Alexander Riedel »

Thank you for sending your script.
On line 31 you are using the following code:
Set objResultsFile = objFSO.CreateTextFile(strResultsFile, 2, True)
The third parameter of the CreateTextFile function determines whether the created file is Unicode or not. Since you set it to 'True' your output is unicode.

More information can be found here: http://msdn2.microsoft.com/en-us/library/5t9b5c0c.aspx


Alex




Alexander Riedel2007-08-07 14:08:27
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
DiZzyDmon
Posts: 73
Last visit: Thu Feb 29, 2024 8:01 am
Has voted: 1 time

Text output in ANSI/ASCII instead of Unicode

Post by DiZzyDmon »

You are correct, it's pure user error. I'm so sorry for having wasted everyone's time, but thanks for the responses.

For the CreateTextFile method of the file system object, the third parameter controls whether the output is Unicode or ASCII. By setting that parameter True (the default is False), the output is Unicode.

I was confusing it with the OpenTextFile method of the file system object, where the third parameter controls whether to create the specified file if it does not already exist.DiZzyDmon2007-08-08 09:27:08
User avatar
tmcdonald46
Posts: 18
Last visit: Thu Oct 04, 2012 2:44 am

Text output in ANSI/ASCII instead of Unicode

Post by tmcdonald46 »

Waste? I'm glad I stumbled across this because it sparked an idea that may lead to a solution to a similar problem I'm having, although that's not what I was in this forum looking for.
This topic is 16 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.