[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: UniversalString throws exception
Thanks a lot Joe.
I will carry up as instructed and sure will request ur help if anything
else.
One query : we add L at the start before "Lé Royal Meridian" may i know what
it implies.
Is there a way that i can convert the ascii string to UTF8 string
Regds
Kaliraj K
-----Original Message-----
From: Grone, Joseph [mailto:joseph.grone@xxxxxxxxxxxxxx]
Sent: Wednesday, September 14, 2005 10:22 PM
To: Sivakumar S - CTD, Chennai.; imc-snacc@xxxxxxx
Cc: Kaliraj Kalaichelvan - CTD, Chennai
Subject: RE: UniversalString throws exception
Siva and Kaliraj,
Our code is actually working as intended. The reason you are failing is
because you are not giving the set function the string in correct utf8 form.
To solve this, I have provided you with the correct code below with a few
inline comments describing what has been changed and why.
int main()
{
UniversalString ustr;
/* This must be declared as a wide character array and, when assigning
a wide character string, the L must be added as a qualifier before the
first double quote
*/
wchar_t ich[32]= L"Lé Royal Meridian";
/* This should be a character pointer because the getAsUTF8 function
returns a strdup'd copy of the UTF8 string. Since memory is already
allocated, it is unnecessary to allocate extra space. This would
leave room for a potential memory leak.
*/
char* och = NULL;
try
{
ustr.set((const char *)&ich[0]);
och = ustr.getAsUTF8(); /* see comment above where och is declared */
}
catch(SnaccException &se)
{
se.getCallStack(std::cout);
cout << "Exception thrown Snacc " <<se.what()<< endl; }
catch(exception &e) {
cout << "Exception thrown : " <<e.what()<< endl;
}
free(och);
return 0;
}
Thank you for asking this question as I'm sure that you guys aren't the only
ones who have ever come across this issue. I hope this solves your problems
and assists you in further devolopment. Please let me know if I can do
anything else for you.
--Joe
-----Original Message-----
From: Sivakumar S - CTD, Chennai. [mailto:sivakumars@xxxxxxxxxxx]
Sent: Wednesday, September 14, 2005 6:55 AM
To: Grone, Joseph; imc-snacc@xxxxxxx
Cc: Kaliraj Kalaichelvan - CTD, Chennai
Subject: RE: UniversalString throws exception
Joe,
I have installed the patch and tried again.
I am getting the same error (Only the error code is changed from 665 to
688).
I have given below the piece of code I tried:
int main()
{
UniversalString ustr;
char ich[32]="Lé Royal Meridian";
unsigned char och[32];
try
{
ustr.set((const char *)&ich[0]);
strcpy((char *)&och[0],ustr.getAsUTF8());
}
catch(SnaccException &se)
{
se.getCallStack(std::cout);
cout << "Exception thrown Snacc " <<se.what()<< endl;
}
catch(exception &e)
{
cout << "Exception thrown : " <<e.what()<< endl;
}
return 0;
}
Output:
asn-stringtype.cpp 688 WideAsnString::set()
Exception Thrown Snacc Invalid UTF-8 string
Thanks,
Siva
-----Original Message-----
From: Grone, Joseph
To: Sivakumar S - CTD, Chennai.; imc-snacc@xxxxxxx
Cc: kalirajk@xxxxxxxxxxx
Sent: 13/09/2005 20:21
Subject: RE: UniversalString throws exception
Before I troubleshoot this problem, I want to make sure that you have
the July 7, 2005 patch installed for eSNACC found here:
http://www.digitalnet.com/knowledge/download.htm
--Joe
-----Original Message-----
From: owner-imc-snacc@xxxxxxxxxxxx [mailto:owner-imc-snacc@xxxxxxxxxxxx]
On Behalf Of Sivakumar S - CTD, Chennai.
Sent: Tuesday, September 13, 2005 10:28 AM
To: imc-snacc@xxxxxxx
Subject: UniversalString throws exception
Importance: High
Hello,
I face a problem with eSNACC (I am using version 1.7).
The ASN throws some exception when I use French characters.
For example, there is one ASN data type called UniversalString.
When I try to store a value "ü" inside the UniversalString it throws an
exception saying "UTF8string invalid".
The storing procedure is the same. It works fine for all English
characters
but when try to use it for French characters like ü or ä like this it
doesnt
work.
Is there a possibility at the code generation time itself (while
generating
VNP_message set.cpp and .h from ASN.1) to make it support these
characters.
Kindly help
Thanks,
Siva
DISCLAIMER
This message and any attachment(s) contained here are information that
is confidential, proprietary to HCL Technologies
and its customers. Contents may be privileged or otherwise protected by
law. The information is solely intended for the
individual or the entity it is addressed to. If you are not the intended
recipient of this message, you are not authorized to
read, forward, print, retain, copy or disseminate this message or any
part of it. If you have received this e-mail in error,
please notify the sender immediately by return e-mail and delete it from
your computer