these are settable in your code behind. there are Page and web config
setting for these that you can use to set the default, or you can override
them in you code.
-- bruce (sqlwork.com)
"Calvin Lai" <calvi...@i010.com> wrote in message
news:_emIb.21428$INs....@twister01.bloor.is.net.cable.rogers.com...
> Does anyone know the difference and usage of them? Great thanks!
HttpResponse.ContentEncoding sets the Encoding object of the underlying
response stream *and* sets the charset of the content-type if
applicable. That's useful if you want to override the default encoding
specified in web.config.
HttpResponse.CharSet only sets the charset of the content-type and does
not effect the actual encoding applied to the output stream -- which
makes it of limited use as far as I'm concerned.
Note that nothing prevents you from doing stuff like
Response.ContentEncoding = Encoding.GetEncoding("Windows-1252");
Response.Charset = "UTF-8";
which is obviously utter nonsense, but sent to the browser anyway ;->
Cheers,
--
Joerg Jooss
joerg...@gmx.net
How could I transform (using Text.Encoding.Convert, GetString, Get Bytes
methods) the data so that the client can still display correctly if I
change the responseEncoding to big5? Is there any way? Thanks a lot. I have
tried so many diferent combinations (which might still be wrong tho). I
really need help here.
Calvin
"bruce barker" <nospam...@safeco.com> wrote in message
news:#6WqGw0z...@TK2MSFTNGP12.phx.gbl...
How could I transform (using Text.Encoding.Convert, GetString, Get Bytes
methods) the data so that the client can still display correctly if I
change the responseEncoding to big5? Is there any way? Thanks a lot. I have
tried so many diferent combinations (which might still be wrong tho). I
really need help here.
Calvin
"Joerg Jooss" <joerg...@gmx.net> wrote in message
news:u6mVHd4...@tk2msftngp13.phx.gbl...
System.Text.Encoding originalEncoding =
System.Text.Encoding.GetEncoding("iso8859-1");
System.Text.Encoding destEncoding =
System.Text.Encoding.GetEncoding("big5");
byte[] originalBytes =
originalEncoding.GetBytes(originalString.ToString());
byte[] destBytes =
System.Text.Encoding.Convert(originalEncoding, destEncoding, originalBytes);
Response.Write(destEncoding.GetString(destBytes) + "<BR>"); <--
Still doens't work. Same string retruned
"Calvin Lai" <calvi...@i010.com> wrote in message
news:g5CIb.185388$2We1....@news04.bloor.is.net.cable.rogers.com...
> Thanks for the clarification. However one problem remaining:
> If my web application now has the responseEncodig set as iso8859-1,
> and the ChatSet of resposne set as "big5". The unicode data
> retrieved from database has no problem displaying in the client side
> browser.
As I said, only setting CharSet is nonsensical if the real encoding is
different from that.
> How could I transform (using Text.Encoding.Convert, GetString, Get
> Bytes methods) the data so that the client can still display
> correctly if I change the responseEncoding to big5? Is there any
> way? Thanks a lot. I have tried so many diferent combinations (which
> might still be wrong tho). I really need help here.
Calvin,
I'm kind of lost. What are you're trying to achieve? Do you want to use
ISO-8859-1 as default response encoding and Big5 in special cases (or
vice versa)? Anyway, set the <globalization /> in web.config to the
desired default encoding and set ContentEncoding to the desired "special
case" encoding instance.