Text encoding in web pages
-
Hi I am building a website with HTTPHandler that handles requests and returns a "text/html" response to the client, the response might be in any language (English, Spanish, Arabic, Indian, etc.). The response that I create will be embedded inside web pages hosted by other websites and those websites will be having different encoding schemes for their pages. my problem is that I don't know how to return a response that is encoded with the same encoding scheme as the web-page that will be embedding the response. I am doing something like this ( I don't know if there is a better way): 1. I have a HttpHandler that handles ".jpg" requests. 2. A user of www.somewebsite.com creates a new topic in the forum, so he uses the image tag to load my text [img]www.mywebsite.com/file.jpg[/img] 3. My website parses the request BUT instead of returning "image/jpeg" response it returns "text/html" response [Don't know what encoding type to use for it] 4. in the forum topic, instead of an image being displayed it will display my html response which might have different encoding than the web page itself, which is the problem. any ideas on solving this problem or doing it in a better way? Thanks
And ever has it been that love knows not its own depth until the hour of separation Mohammad Gdeisat
-
Hi I am building a website with HTTPHandler that handles requests and returns a "text/html" response to the client, the response might be in any language (English, Spanish, Arabic, Indian, etc.). The response that I create will be embedded inside web pages hosted by other websites and those websites will be having different encoding schemes for their pages. my problem is that I don't know how to return a response that is encoded with the same encoding scheme as the web-page that will be embedding the response. I am doing something like this ( I don't know if there is a better way): 1. I have a HttpHandler that handles ".jpg" requests. 2. A user of www.somewebsite.com creates a new topic in the forum, so he uses the image tag to load my text [img]www.mywebsite.com/file.jpg[/img] 3. My website parses the request BUT instead of returning "image/jpeg" response it returns "text/html" response [Don't know what encoding type to use for it] 4. in the forum topic, instead of an image being displayed it will display my html response which might have different encoding than the web page itself, which is the problem. any ideas on solving this problem or doing it in a better way? Thanks
And ever has it been that love knows not its own depth until the hour of separation Mohammad Gdeisat
Mohammad A Gdeisat wrote:
response it returns "text/html" response [Don't know what encoding type to use for it]
It's not encoding, it's content type. Set the content type of response from HTTPHandler to "image/jpeg"
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions
-
Mohammad A Gdeisat wrote:
response it returns "text/html" response [Don't know what encoding type to use for it]
It's not encoding, it's content type. Set the content type of response from HTTPHandler to "image/jpeg"
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions
Hi as I wrote in the question, although the request is an image request, the response is "text/html" response, I am not sending any image files. The text will display correctly only if the encoding I use in the response matches the encoding of the web-page that receives the html response.
And ever has it been that love knows not its own depth until the hour of separation Mohammad Gdeisat