473,396 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

UTF8>UNICODE

Hi

My ASP pages uses UTF-8 encoding.

How to convert UTF-8 text from Request.Form("text") to UNICODE for searching
frm MSSQL Database?

Best regards;
Meelis

Apr 25 '06 #1
15 10804

"Meelis Lilbok" <me***********@deltmar.ee> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Hi

My ASP pages uses UTF-8 encoding.

How to convert UTF-8 text from Request.Form("text") to UNICODE for searching frm MSSQL Database?

Best regards;
Meelis


x = Request.Form("text").

x now contains a Unicode string

When passing to a ADO command object parameter make sure the parameter type
is adVarWChar.

Anthony.
Apr 25 '06 #2
>
x = Request.Form("text").


Nope, x is in UTF-8 format! Thats the problem

I use activex dll and API calls to convert UTF-8 to UNICODE, but where use
of activex is disabled this will not work

Meelis
Apr 25 '06 #3

"Meelis Lilbok" <me***********@deltmar.ee> wrote in message
news:%2******************@TK2MSFTNGP02.phx.gbl...

x = Request.Form("text").


Nope, x is in UTF-8 format! Thats the problem

I use activex dll and API calls to convert UTF-8 to UNICODE, but where use
of activex is disabled this will not work

Meelis


VBScript supports only one string format and that is Unicode.

I suspect that the form submission is using UTF-8 but the server side script
doesn't know that and is treating it as ISO-8859-1 or the like. Hence you
are getting a Unicode string that contains a series of UTF-8 encodings.

What is the character encoding of page that contains the text control?

Does the page actually inform the client of the character encoding used for
the page?

What method is used to submit the form GET or POST?

What is the Enctype of the form?

Is AcceptCharset specified for the Form?

What Browser are you using?

Anthony.
Apr 25 '06 #4
> What is the character encoding of page that contains the text control?
UTF-8


Does the page actually inform the client of the character encoding used
for
the page? Yes

What method is used to submit the form GET or POST? POST
What is the Enctype of the form?
None, because page encoding is UTF-8
Is AcceptCharset specified for the Form? No
What Browser are you using?

IE6

Meelis
Apr 25 '06 #5
For example

If i enter into text box estonian word "väike"
and submit form to antoher pages search.asp
and read Request.Form("text")
i get väike (UTF-8)

Meelis


"Anthony Jones" <An*@yadayadayada.com> wrote in message
news:ul**************@TK2MSFTNGP03.phx.gbl...

"Meelis Lilbok" <me***********@deltmar.ee> wrote in message
news:%2******************@TK2MSFTNGP02.phx.gbl...
>
> x = Request.Form("text").


Nope, x is in UTF-8 format! Thats the problem

I use activex dll and API calls to convert UTF-8 to UNICODE, but where
use
of activex is disabled this will not work

Meelis


VBScript supports only one string format and that is Unicode.

I suspect that the form submission is using UTF-8 but the server side
script
doesn't know that and is treating it as ISO-8859-1 or the like. Hence you
are getting a Unicode string that contains a series of UTF-8 encodings.

What is the character encoding of page that contains the text control?

Does the page actually inform the client of the character encoding used
for
the page?

What method is used to submit the form GET or POST?

What is the Enctype of the form?

Is AcceptCharset specified for the Form?

What Browser are you using?

Anthony.

Apr 25 '06 #6

"Meelis Lilbok" <me***********@deltmar.ee> wrote in message
news:em**************@TK2MSFTNGP02.phx.gbl...
For example

If i enter into text box estonian word "väike"
and submit form to antoher pages search.asp
and read Request.Form("text")
i get väike (UTF-8)


Having looked into it a bit more it would seem that the forms approach just
isn't compatible with UTF-8 or unicode. There doesn't seem to be a way to
inform the server of the actual charset used to encode the form values.

I'm actually quite amazed at this.

What do you actually need to do?

Do you need to support input characters beyond ISO-8859-1? If not I would
suggest you ditch UTF-8 and use ISO-8859-1 everywhere instead.

Other wise it is possible to do the decoding in VBScript yourself but it's
really messy. A small VB6 component would make this a lot easier.

Ditching Forms may be another option and post XML instead. (This is what I
do, I don't use forms)

Anthony.
Apr 25 '06 #7
Hi

cant use ISO-8859-1, beacuse i need support cyrillic chars too.
its easier to use my activex dll with convert functions :))
Best Regadrs;
Meelis


"Anthony Jones" <An*@yadayadayada.com> wrote in message
news:%2***************@TK2MSFTNGP05.phx.gbl...

"Meelis Lilbok" <me***********@deltmar.ee> wrote in message
news:em**************@TK2MSFTNGP02.phx.gbl...
For example

If i enter into text box estonian word "väike"
and submit form to antoher pages search.asp
and read Request.Form("text")
i get väike (UTF-8)


Having looked into it a bit more it would seem that the forms approach
just
isn't compatible with UTF-8 or unicode. There doesn't seem to be a way to
inform the server of the actual charset used to encode the form values.

I'm actually quite amazed at this.

What do you actually need to do?

Do you need to support input characters beyond ISO-8859-1? If not I would
suggest you ditch UTF-8 and use ISO-8859-1 everywhere instead.

Other wise it is possible to do the decoding in VBScript yourself but it's
really messy. A small VB6 component would make this a lot easier.

Ditching Forms may be another option and post XML instead. (This is what
I
do, I don't use forms)

Anthony.

Apr 26 '06 #8

"Meelis Lilbok" <me***********@deltmar.ee> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Hi

My ASP pages uses UTF-8 encoding.

How to convert UTF-8 text from Request.Form("text") to UNICODE for
searching frm MSSQL Database?


use at the first line of your ASP page
<% codepage=65001%>

--
compatible web farm Session replacement for Asp and Asp.Net
http://www.nieropwebconsult.nl/asp_session_manager.htm

Apr 26 '06 #9

"Egbert Nierop (MVP for IIS)" <eg***********@nospam.invalid> wrote in
message news:ud**************@TK2MSFTNGP05.phx.gbl...

"Meelis Lilbok" <me***********@deltmar.ee> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Hi

My ASP pages uses UTF-8 encoding.

How to convert UTF-8 text from Request.Form("text") to UNICODE for
searching frm MSSQL Database?
use at the first line of your ASP page
<% codepage=65001%>


did you mean:-

<%@ codepage=65001 %>

I don't think that helps. The value of session.codepage doesn't seem to
impact the assumptions made by server about the encoding of the request
data.
--
compatible web farm Session replacement for Asp and Asp.Net
http://www.nieropwebconsult.nl/asp_session_manager.htm

Apr 26 '06 #10

"Anthony Jones" <An*@yadayadayada.com> wrote in message
news:es**************@TK2MSFTNGP04.phx.gbl...

"Egbert Nierop (MVP for IIS)" <eg***********@nospam.invalid> wrote in
message news:ud**************@TK2MSFTNGP05.phx.gbl...

"Meelis Lilbok" <me***********@deltmar.ee> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
> Hi
>
> My ASP pages uses UTF-8 encoding.
>
> How to convert UTF-8 text from Request.Form("text") to UNICODE for
> searching frm MSSQL Database?
use at the first line of your ASP page
<% codepage=65001%>


did you mean:-

<%@ codepage=65001 %>

I don't think that helps. The value of session.codepage doesn't seem to
impact the assumptions made by server about the encoding of the request
data.


however you are wrong :)

This really is saying that all input Request.* and output (response.write)
processes UTF-8 format.

--
compatible web farm Session replacement for Asp and Asp.Net
http://www.nieropwebconsult.nl/asp_session_manager.htm



Apr 26 '06 #11
Hi Egbert
Problem is not displayng UTF-8, all pages are using UTF-8
Problem is when i wanna make a query from MSSQL server, then i must convert
UTF-8 to UNICODE.

And <% codepage=65001%> does not work on IIS4 :)

And this is only possible when i use ActiveX DLL with MultiByteToWidechar
and WideCharToMultybite API's.

Meelis


"Egbert Nierop (MVP for IIS)" <eg***********@nospam.invalid> wrote in
message news:eY**************@TK2MSFTNGP03.phx.gbl...

"Anthony Jones" <An*@yadayadayada.com> wrote in message
news:es**************@TK2MSFTNGP04.phx.gbl...

"Egbert Nierop (MVP for IIS)" <eg***********@nospam.invalid> wrote in
message news:ud**************@TK2MSFTNGP05.phx.gbl...

"Meelis Lilbok" <me***********@deltmar.ee> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
> Hi
>
> My ASP pages uses UTF-8 encoding.
>
> How to convert UTF-8 text from Request.Form("text") to UNICODE for
> searching frm MSSQL Database?

use at the first line of your ASP page
<% codepage=65001%>


did you mean:-

<%@ codepage=65001 %>

I don't think that helps. The value of session.codepage doesn't seem to
impact the assumptions made by server about the encoding of the request
data.


however you are wrong :)

This really is saying that all input Request.* and output (response.write)
processes UTF-8 format.

--
compatible web farm Session replacement for Asp and Asp.Net
http://www.nieropwebconsult.nl/asp_session_manager.htm


Apr 27 '06 #12

"Meelis Lilbok" <me***********@deltmar.ee> wrote in message
news:Od**************@TK2MSFTNGP04.phx.gbl...
Hi Egbert
Problem is not displayng UTF-8, all pages are using UTF-8
Problem is when i wanna make a query from MSSQL server, then i must
convert UTF-8 to UNICODE.

And <% codepage=65001%> does not work on IIS4 :)
Why didn't you say so.
IIS4 indeed does not support that. Or better said, Oleautomation does not
support, so ADO and others do not support that either.
I'd really work on asking your boss upgrading! Because, if you need to
convert it manually, it will be a hard job, you'll end up converting all SQL
data / user-input data etc!

And this is only possible when i use ActiveX DLL with MultiByteToWidechar
and WideCharToMultybite API's. Meelis


"Egbert Nierop (MVP for IIS)" <eg***********@nospam.invalid> wrote in
message news:eY**************@TK2MSFTNGP03.phx.gbl...

"Anthony Jones" <An*@yadayadayada.com> wrote in message
news:es**************@TK2MSFTNGP04.phx.gbl...

"Egbert Nierop (MVP for IIS)" <eg***********@nospam.invalid> wrote in
message news:ud**************@TK2MSFTNGP05.phx.gbl...

"Meelis Lilbok" <me***********@deltmar.ee> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
> Hi
>
> My ASP pages uses UTF-8 encoding.
>
> How to convert UTF-8 text from Request.Form("text") to UNICODE for
> searching frm MSSQL Database?

use at the first line of your ASP page
<% codepage=65001%>
did you mean:-

<%@ codepage=65001 %>

I don't think that helps. The value of session.codepage doesn't seem to
impact the assumptions made by server about the encoding of the request
data.


however you are wrong :)

This really is saying that all input Request.* and output
(response.write) processes UTF-8 format.


--
compatible web farm Session replacement for Asp and Asp.Net
http://www.nieropwebconsult.nl/asp_session_manager.htm



Apr 27 '06 #13
Yeah i know

Some our clients still!! use IIS4 and then i use again my ActiveX DLL to
convert all strings to UTF-8, works fine ;)
Meelis

"Egbert Nierop (MVP for IIS)" <eg***********@nospam.invalid> wrote in
message news:Oq**************@TK2MSFTNGP05.phx.gbl...

"Meelis Lilbok" <me***********@deltmar.ee> wrote in message
news:Od**************@TK2MSFTNGP04.phx.gbl...
Hi Egbert
Problem is not displayng UTF-8, all pages are using UTF-8
Problem is when i wanna make a query from MSSQL server, then i must
convert UTF-8 to UNICODE.

And <% codepage=65001%> does not work on IIS4 :)


Why didn't you say so.
IIS4 indeed does not support that. Or better said, Oleautomation does not
support, so ADO and others do not support that either.
I'd really work on asking your boss upgrading! Because, if you need to
convert it manually, it will be a hard job, you'll end up converting all
SQL data / user-input data etc!

And this is only possible when i use ActiveX DLL with MultiByteToWidechar
and WideCharToMultybite API's.

Meelis


"Egbert Nierop (MVP for IIS)" <eg***********@nospam.invalid> wrote in
message news:eY**************@TK2MSFTNGP03.phx.gbl...

"Anthony Jones" <An*@yadayadayada.com> wrote in message
news:es**************@TK2MSFTNGP04.phx.gbl...

"Egbert Nierop (MVP for IIS)" <eg***********@nospam.invalid> wrote in
message news:ud**************@TK2MSFTNGP05.phx.gbl...
>
> "Meelis Lilbok" <me***********@deltmar.ee> wrote in message
> news:%2****************@TK2MSFTNGP04.phx.gbl...
> > Hi
> >
> > My ASP pages uses UTF-8 encoding.
> >
> > How to convert UTF-8 text from Request.Form("text") to UNICODE for
> > searching frm MSSQL Database?
>
> use at the first line of your ASP page
> <% codepage=65001%>
>

did you mean:-

<%@ codepage=65001 %>

I don't think that helps. The value of session.codepage doesn't seem
to
impact the assumptions made by server about the encoding of the request
data.

however you are wrong :)

This really is saying that all input Request.* and output
(response.write) processes UTF-8 format.

> --
> compatible web farm Session replacement for Asp and Asp.Net
> http://www.nieropwebconsult.nl/asp_session_manager.htm
>


Apr 27 '06 #14

"Egbert Nierop (MVP for IIS)" <eg***********@nospam.invalid> wrote in
message news:eY**************@TK2MSFTNGP03.phx.gbl...

"Anthony Jones" <An*@yadayadayada.com> wrote in message
news:es**************@TK2MSFTNGP04.phx.gbl...

"Egbert Nierop (MVP for IIS)" <eg***********@nospam.invalid> wrote in
message news:ud**************@TK2MSFTNGP05.phx.gbl...

"Meelis Lilbok" <me***********@deltmar.ee> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
> Hi
>
> My ASP pages uses UTF-8 encoding.
>
> How to convert UTF-8 text from Request.Form("text") to UNICODE for
> searching frm MSSQL Database?

use at the first line of your ASP page
<% codepage=65001%>

did you mean:-

<%@ codepage=65001 %>

I don't think that helps. The value of session.codepage doesn't seem to
impact the assumptions made by server about the encoding of the request
data.


however you are wrong :)


I am. Don't how I managed it in my first round of tests. Did them again
and it works as you say.

The receiving page needs to be using a codepage that matches the character
set that the client browser thinks the source page is using.

In IIS 5.1/IIS 6 setting Response.codepage has the same effect which is a
bit counter intuative.

This really is saying that all input Request.* and output (response.write)
processes UTF-8 format.

--
compatible web farm Session replacement for Asp and Asp.Net
http://www.nieropwebconsult.nl/asp_session_manager.htm


Apr 27 '06 #15

"Anthony Jones" <An*@yadayadayada.com> wrote in message
news:uB**************@TK2MSFTNGP04.phx.gbl...

"Egbert Nierop (MVP for IIS)" <eg***********@nospam.invalid> wrote in
message news:eY**************@TK2MSFTNGP03.phx.gbl...

"Anthony Jones" <An*@yadayadayada.com> wrote in message
news:es**************@TK2MSFTNGP04.phx.gbl...
>
> "Egbert Nierop (MVP for IIS)" <eg***********@nospam.invalid> wrote in
> message news:ud**************@TK2MSFTNGP05.phx.gbl...
>>
>> "Meelis Lilbok" <me***********@deltmar.ee> wrote in message
>> news:%2****************@TK2MSFTNGP04.phx.gbl...
>> > Hi
>> >
>> > My ASP pages uses UTF-8 encoding.
>> >
>> > How to convert UTF-8 text from Request.Form("text") to UNICODE for
>> > searching frm MSSQL Database?
>>
>> use at the first line of your ASP page
>> <% codepage=65001%>
>>
>
> did you mean:-
>
> <%@ codepage=65001 %>
>
> I don't think that helps. The value of session.codepage doesn't seem
> to
> impact the assumptions made by server about the encoding of the request
> data.
however you are wrong :)


I am. Don't how I managed it in my first round of tests. Did them again
and it works as you say.

The receiving page needs to be using a codepage that matches the character
set that the client browser thinks the source page is using.


Right, and that is set by using

Response.CharSet = "utf-8"
In IIS 5.1/IIS 6 setting Response.codepage has the same effect which is a
bit counter intuative.

This really is saying that all input Request.* and output
(response.write)
processes UTF-8 format.


Apr 28 '06 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: gabor | last post by:
hi, today i made some tests... i tested some unicode symbols, that are above the 16bit limit (gothic:http://www.unicode.org/charts/PDF/U10330.pdf) .. i played around with iconv and so on,...
16
by: ^_^ | last post by:
conversion from: a="a"; to a=0x????; If there are many unicode strings to convert, how can I do batch-conversion?
22
by: Martin Trautmann | last post by:
Hi all, is there any kind of 'hiconv' or other (unix-like) conversion tool that would convert UTF-8 to HTML (ISO-Latin-1 and Unicode)? The database output is UTF-8 or UTF-16 only - Thus almost...
12
by: chunhui_true | last post by:
i have a class, it can read one line(\r\n ended) from string,when i read line from utf8 string i can't get any thing! maybe i should conversion utf8 to ascii??there is any function can conversion...
5
by: Jazper | last post by:
hi can anybody explain that to me: i did the following: - 1. input of char 244 ("ô") into string - 2. convert to getbytes - 3. convert back to string char 244 changed to char 63 ("?")...
2
by: Joey Lee | last post by:
Hi, Does anyone know how I am able to write a utf-8 encoded binary string into binary file? Currently I am given a UTF-8 string which was read from a gif image. Here are my functions... ...
3
by: David | last post by:
hello... i've a little problem here... n00b question -)) so if you can help me... the "output" string bellow, comes in UNICODE, but i want to get it on windows-1251 (cytillic) how can i do...
6
by: Bob Altman | last post by:
Hi all, I'm looking for the fastest way to convert an array of bytes to String. I also need to convert a String back to its original Byte() representation. Convert.ToBase64String and...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.