This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: FileGrep and non English characters
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 10, 2009
11:08 AM
FileGrep and non English characters
I'm trying to use FileGrep in a function to determine the state of service on the target machine.
The function calls a wrapper application which then runs Microsofts sc.exe application to query the service control module regarding the named service. The output of this call is sent to a text file in the local temp folder. I then use FileGrep to parse this text file to extract the service state.
This works fine on XP and English Vista systems but on Vista, Win2k3 server and later OS, the output of sc.exe is part localised.
So on a Swedish system I get extended swedish characters. FileGrep cant read these as the extended characters seem to be mapped to a different font / codepage when read from the text file.
My question is, is there any way to force the codepage / fomt of a file opened using FileGrep?
The function calls a wrapper application which then runs Microsofts sc.exe application to query the service control module regarding the named service. The output of this call is sent to a text file in the local temp folder. I then use FileGrep to parse this text file to extract the service state.
This works fine on XP and English Vista systems but on Vista, Win2k3 server and later OS, the output of sc.exe is part localised.
So on a Swedish system I get extended swedish characters. FileGrep cant read these as the extended characters seem to be mapped to a different font / codepage when read from the text file.
My question is, is there any way to force the codepage / fomt of a file opened using FileGrep?
(4) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 10, 2009
11:29 AM
Would it make more sense to use InstallScript's service APIs? In particular ServiceGetServiceState might do what you want without requiring you to parse output at all.
I don't see any way to influence the codepage used for reading from a file. It appears we support just binary, ANSI (ACP), and Unicode options (as discussed on OpenFileMode).
I don't see any way to influence the codepage used for reading from a file. It appears we support just binary, ANSI (ACP), and Unicode options (as discussed on OpenFileMode).
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 10, 2009
11:56 AM
I tried the built in ServiceGetServiceState functions on Installshield 2008 and they didnt work on Vista. I assumed that behaviour would continue in Installshield 2009, so I abandoned that method and went for sc.exe instead. The help for ServiceGetServiceState and its related functions indicate that they are only compatible with OSs up to XP.
Maybe I'll have to investigate using OpenFileMode and parse the file in code.
Thanks
Maybe I'll have to investigate using OpenFileMode and parse the file in code.
Thanks
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 11, 2009
10:53 AM
Ah, yes, we have a tracking number for fixing the Service* APIs to only require administrator privileges when the action they perform requires it. This number is IOC-000059857, and it has not been addressed yet as of IS 2010. You can see some more information with a possible alternative on the thread: http://community.installshield.com/showthread.php?t=169135
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 11, 2009
11:42 AM
Hi Michael,
I managed to resolve my problem by forcing my wrapper app to output the captured sc.exe output as a Unicode encoded text file. When Filegrep read these files it handled the extended charatetrs corretly.
When my wrapper app used the default encoding there seemed to be some character mapping which broke things. Thanks for the pointer to FileOpenMode, that gave me the hint about forcing unicode encoding.
Cheers
Highlander23
🙂
I managed to resolve my problem by forcing my wrapper app to output the captured sc.exe output as a Unicode encoded text file. When Filegrep read these files it handled the extended charatetrs corretly.
When my wrapper app used the default encoding there seemed to be some character mapping which broke things. Thanks for the pointer to FileOpenMode, that gave me the hint about forcing unicode encoding.
Cheers
Highlander23
🙂
![](/skins/images/CC38E504FC9E1309DC48ACFEB4925670/responsive_peak/images/icon_anonymous_message.png)