473,408 Members | 1,874 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,408 software developers and data experts.

Wrong encoding reading form fields

Hi,

im using a form to get some input from the user. This form is in a
HTML file.

When I post the form directly to my email, i receive all fields
correctly. Example test.html:
<FORM action="MAILTO:my*****@work.com" method=post
enctype="text/plain">

But if I post the form to an aspx page and try to read the fields
value, i get the wrong encoding content. Example

test.html:
<FORM action="test.aspx" method=post>

test.aspx
for(int i=0 ; i<Request.Form.Count; i++)
Response.Write(Request.Form.Keys[i]+"="+Request.Form[i]);

This will print all fields and values, but without any portuguese
characters.

So, anyone knows were i must define the encoding to solve this
problem? ive tried putting in metatag in test.html page, tried putting
in page directive in test.aspx page. Nothing works.

Wich encoding is responsible form Request.Form values?
Thanks,
Nelson R.
Nov 19 '05 #1
3 2091

"Nelson R." <n [th0t] russa [at] ebase [th0t] pt> wrote in message
news:dn********************************@4ax.com...
for(int i=0 ; i<Request.Form.Count; i++)
Response.Write(Request.Form.Keys[i]+"="+Request.Form[i]);

This will print all fields and values, but without any portuguese
characters.


Hi!

I have had a similar problem with danish characters. I solved the problem by
using the HtmlEncode method.
You only have to encode the strings you send to the server (your aspx page)
and the server will automaticly decode the string.

If you look the HtmlEcode method up in the documentation I am certain, that
you will find a solution to your problem.

Best regards
Torben
Nov 19 '05 #2
Hi Torben,
thanks for your response.

I understand the use of Server.HtmlEncode when encoding an URL
parameters.
But in my situation, I have an HTML page with a form posting to an
ASPX page. I can only use server code when reading form fields in ASPX
page.

When posting directly to an email, the characters are correct, but
when posting to an ASPX page all portuguese chars are gone... so I
supose the problem is in the ASPX page, that should be using the
correct encoding for reading posted form fields...

Any ideas?

Nelson R.


On Thu, 6 Jan 2005 20:00:03 +0100, "Torben Philippsen" <no@mail.dk>
wrote:

"Nelson R." <n [th0t] russa [at] ebase [th0t] pt> wrote in message
news:dn********************************@4ax.com.. .
for(int i=0 ; i<Request.Form.Count; i++)
Response.Write(Request.Form.Keys[i]+"="+Request.Form[i]);

This will print all fields and values, but without any portuguese
characters.


Hi!

I have had a similar problem with danish characters. I solved the problem by
using the HtmlEncode method.
You only have to encode the strings you send to the server (your aspx page)
and the server will automaticly decode the string.

If you look the HtmlEcode method up in the documentation I am certain, that
you will find a solution to your problem.

Best regards
Torben


Nov 19 '05 #3
Hi,

solved my problem. Needed to change encoding in webconfig to:

<globalization requestEncoding="windows-1252"
responseEncoding="windows-1252" />
Now its working.
Nelson R.

On Fri, 07 Jan 2005 09:46:34 +0000, Nelson R. <n [th0t] russa [at]
ebase [th0t] pt> wrote:
Hi Torben,
thanks for your response.

I understand the use of Server.HtmlEncode when encoding an URL
parameters.
But in my situation, I have an HTML page with a form posting to an
ASPX page. I can only use server code when reading form fields in ASPX
page.

When posting directly to an email, the characters are correct, but
when posting to an ASPX page all portuguese chars are gone... so I
supose the problem is in the ASPX page, that should be using the
correct encoding for reading posted form fields...

Any ideas?

Nelson R.


On Thu, 6 Jan 2005 20:00:03 +0100, "Torben Philippsen" <no@mail.dk>
wrote:

"Nelson R." <n [th0t] russa [at] ebase [th0t] pt> wrote in message
news:dn********************************@4ax.com. ..
for(int i=0 ; i<Request.Form.Count; i++)
Response.Write(Request.Form.Keys[i]+"="+Request.Form[i]);

This will print all fields and values, but without any portuguese
characters.


Hi!

I have had a similar problem with danish characters. I solved the problem by
using the HtmlEncode method.
You only have to encode the strings you send to the server (your aspx page)
and the server will automaticly decode the string.

If you look the HtmlEcode method up in the documentation I am certain, that
you will find a solution to your problem.

Best regards
Torben


Nov 19 '05 #4

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

Similar topics

1
by: Randell D. | last post by:
HELP! I am determined to stick with this... I'm getting there... for those who haven't read my earlier posts, I'm createing what should be a simple function that I can call to check that...
3
by: Alan Pocklington | last post by:
Hi, I've created a Java Applet that allows the user to select a record. As the user makes the selection, the applet uses LiveConnect (JSObject) to write the record id to a html field (the name...
2
by: joewhitehair | last post by:
Using the XSD.exe tool, I created a number of classes from my XSD file. When I generate the WSDL for my web service, the schema does not have the proper Occurance constraints for the attributes. In...
2
by: joakim.hove | last post by:
Hello, I am having great problems writing norwegian characters æøå to file from a python application. My (simplified) scenario is as follows: 1. I have a web form where the user can enter his...
19
by: Thomas W | last post by:
I'm getting really annoyed with python in regards to unicode/ascii-encoding problems. The string below is the encoding of the norwegian word "fødselsdag". I stored the string as "fødselsdag"...
3
by: mortb | last post by:
1. How do I determine which encoding a xmldocument or xmlreader uses when opening a document? I'm not just talking about the <?xml encoding="utf-8"?attribute, but the actual encoding of the...
8
by: Erwin Moller | last post by:
Hi group, I could use a bit of guidance on the following matter. I am starting a new project now and must make some decisions regarding encoding. Environment: PHP4.3, Postgres7.4.3 I must...
1
by: maxxxxel | last post by:
Hi Can anyone help me with some asp code , I changed the code to use CDO.message instead of the old cdont.sys to send mail from a ASP webpage which works fine. Our problem is that when we send...
16
by: raylopez99 | last post by:
I am running out of printing paper trying to debug this...it has to be trivial, but I cannot figure it out--can you? Why am I not printing text, but just the initial string "howdy"? On the...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.