- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Problem in getting cmd line agruments on korea...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2009 04:25 AM
03-30-2009 04:25 AM
Problem in getting cmd line agruments on korean HPUX 11.11 machine
I am using HPUX11.11 machine to get command line arguments in korean text with following code
// Locale set to ko_KR.eucKR
pid = atoi(argv[1]);
pu.pst_command = long_command;
if (pstat(PSTAT_GETCOMMANDLINE, pu, MAX_LENGTH, 1, pid) != -1) {
// converting pu.pst_command to wide char using mbstowcs()
//returning wide char
}
but wide char contains garbled value ...
can someone help me on this
or i am using wrong api ...
Thxn in advance
Srikanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2009 04:10 PM
03-30-2009 04:10 PM
Re: Problem in getting cmd line agruments on korean HPUX 11.11 machine
Have you set the proper locale?
Have you looked at the raw hex values in pst_command and with argv in that process?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2009 07:27 PM
03-30-2009 07:27 PM
Re: Problem in getting cmd line agruments on korean HPUX 11.11 machine
Plz let me know how to check for the hex values.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2009 09:06 PM
03-30-2009 09:06 PM
Re: Problem in getting cmd line agruments on korean HPUX 11.11 machine
You can loop though each unsigned char in pst_command and print in hex:
const unsigned char *p = (const unsigned char*)pu.pst_command;
for (; p; ++p)
printf("%02x ", *p);
printf("\n");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2009 10:15 PM
04-01-2009 10:15 PM
Re: Problem in getting cmd line agruments on korean HPUX 11.11 machine
Iterated thru pst_command , the raw hex are correct.
The issue is with mbstowcs() method.
here is the code ......
setLocale(LC_TYPE,"ko_KR.eucKR");
pu.pst_command = long_command;
wchar_t *wideCharString;
size_t size;
char *strCmdMatch;
strCmdMatch = (char *) malloc ((sizeof (char)) * MAX_LENGTH);
memset (strCmdMatch, '\0', (sizeof (char)) * MAX_LENGTH);
if (pstat(PSTAT_GETCOMMANDLINE, pu, MAX_LENGTH, 1, pid) != -1) {
// converting pu.pst_command to wide char using mbstowcs()for using in java code
int requiredSize = strlen(strCmdMatch);
wideCharString = (wchar_t *)malloc( (requiredSize + 1) * sizeof( wchar_t ));
size = mbstowcs( wideCharString,strCmdMatch, requiredSize+1);
//returning wide char to java using NewString()
}
mbstowcs () is not converting multibyte char to wide char string properly
Plz help me ............
~ Srikanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2009 10:18 PM
04-01-2009 10:18 PM
Re: Problem in getting cmd line agruments on korean HPUX 11.11 machine
Hi Dennis,
Iterated thru pst_command , the raw hex are correct.
The issue is with mbstowcs() method.
here is the code ......
setLocale(LC_TYPE,"ko_KR.eucKR");
pu.pst_command = long_command;
wchar_t *wideCharString;
size_t size;
if (pstat(PSTAT_GETCOMMANDLINE, pu, MAX_LENGTH, 1, pid) != -1) {
// converting pu.pst_command to wide char using mbstowcs()for using in java code
int requiredSize = strlen(pu.pst_command);
wideCharString = (wchar_t *)malloc( (requiredSize + 1) * sizeof( wchar_t ));
size =mbstowcs(wideCharString,pu.pst_command,requiredSize+1);
//returning wide char to java using NewString()
}
mbstowcs () is not converting multibyte char to wide char string properly
Plz help me ............
~ Srikanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2009 02:48 AM
04-02-2009 02:48 AM
Re: Problem in getting cmd line agruments on korean HPUX 11.11 machine
Can you provide the values?
What is the return value of mbstowcs?
What codeset is java using?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2009 03:10 AM
04-02-2009 03:10 AM
Re: Problem in getting cmd line agruments on korean HPUX 11.11 machine
76 69 20 c7 d1 b1 db
>> What is the return value of mbstowcs?
strlen(pu.pst_command)=7
return value of mbstowcs() is bytes req to convert mbstowcs (5 in my case)
>> What codeset is java using?
windows w2k3 korean OS with codeset MS949
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2009 11:59 PM
04-02-2009 11:59 PM
Re: Problem in getting cmd line agruments on korean HPUX 11.11 machine
This is: vi ??
$ a.out
locale==ko_KR.eucKR
codeset(62) is eucKR
size: 5
str: vi úîà Ã
wstr: vi úîà Ã
00000076 00000069 00000020 0000c7d1 0000b1db
So the wchar_t value is just the two byte value.
>windows w2k3 korean OS with codeset MS949
What wchar_t value do you thinks these should have?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2009 01:21 AM
04-03-2009 01:21 AM
Re: Problem in getting cmd line agruments on korean HPUX 11.11 machine
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2009 01:34 AM
04-03-2009 01:34 AM
Re: Problem in getting cmd line agruments on korean HPUX 11.11 machine
Yes, I guessed that. :-)
The value you are getting is that value. Your problem is that you need to convert that character encoding to java's.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2009 01:45 AM
04-03-2009 01:45 AM
Re: Problem in getting cmd line agruments on korean HPUX 11.11 machine
No , i am not getting the expected value i.e the file name @ cmd line , its garbled
>>Your problem is that you need to convert that character encoding to java's.
if i convert the string to wchar_t , the iss ue will be solved i.e mbstowcs takes care pf conversion
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2009 02:52 AM
04-03-2009 02:52 AM
Re: Problem in getting cmd line agruments on korean HPUX 11.11 machine
Please convert the correct name to hex and attach:
echo korean_filename | xd -tx1
>if i convert the string to wchar_t, the issue will be solved i.e mbstowcs takes care pf conversion
I printed the original hex string you provided, with %s and the wchar_t string with %ls and I got the same thing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2009 03:38 AM
04-03-2009 03:38 AM
Re: Problem in getting cmd line agruments on korean HPUX 11.11 machine
> echo à à ±à | xd -tx1
0000000 c7 d1 b1 db a
0000005
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2009 03:09 PM
04-03-2009 03:09 PM
Re: Problem in getting cmd line agruments on korean HPUX 11.11 machine
0000000 c7 d1 b1 db a
This indicates everything is working. You have the right command line and you have the right wchar_t string. But you may have the wrong codeset for windows.
That's assuming when you do a "ls à  à  à ±à " it finds the file.