how to display a BSTR string returned by c++ component in HTML

B

babu17

hi,

i have an asp page which creates a object using server.createobject and
uses its method.

example:

set obj1= server.createobject("test.test") ' test is a dll
tmp = obj1.method() ' it returns a BSTR string.

i want to display tmp in HTML. when i tried to print tmp like
<font><%=tmp%></font>

i get some garbage value.
any idea.
thanks
 
A

Anthony Jones

babu17 said:
hi,

i have an asp page which creates a object using server.createobject and
uses its method.

example:

set obj1= server.createobject("test.test") ' test is a dll
tmp = obj1.method() ' it returns a BSTR string.

i want to display tmp in HTML. when i tried to print tmp like
<font><%=tmp%></font>

i get some garbage value.
any idea.
thanks

A BSTR is the native string data type used by ASP scripts.

<%=tmp%>

Is a reasonable way to send the string to the client. However the string
will be converted to the current Response or Session CodePage. This
defaults to the servers system codepage.

If tmp is holding say some Cryllic characters and you attempt to write to
the client whilst the current response codepage is Western Latin then you
can expect to see garbage.

Anthony.
 
E

Egbert Nierop \(MVP for IIS\)

babu17 said:
hi,

i have an asp page which creates a object using server.createobject and
uses its method.

example:

it would be a good idea to show us the C++ component code.
Most times this goes wrong, the programmer assumes that a BSTR is a LPWSTR
or faulty encodes
obj1.method()
 
A

abcd

In C++ method you can use BSTR CopyTo call this allocates the new fresh
string and u can see it in asp page
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,142
Messages
2,570,820
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top