Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Text encoding in web pages

Text encoding in web pages

Scheduled Pinned Locked Moved ASP.NET
htmlcomhardwarehelptutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mohammad A Gdeisat
    wrote on last edited by
    #1

    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

    N 1 Reply Last reply
    0
    • M Mohammad A 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

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      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

      M 1 Reply Last reply
      0
      • N N a v a n e e t h

        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

        M Offline
        M Offline
        Mohammad A Gdeisat
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups