472,958 Members | 2,236 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 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 10784

"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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.