Click here to Skip to main content
15,886,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi

I have a xml file as string . I need to send it to browser in Japan Language . Tried with following code but did't convert . Please check my code for any issues .


//string StrEncoding = "Shift_JIS";
//Encoding ascii = Encoding.GetEncoding(StrEncoding);
//Encoding japanese = Encoding.GetEncoding(20127);
//byte[] unicodeBytes = ascii.GetBytes(xslXml);
//byte[] arrReportContaint = Encoding.Convert(ascii, japanese, unicodeBytes);




C#
private void LoadExcelData(string xslXml, string header)
       {
           UTF8Encoding encoder = new UTF8Encoding();
           byte[] arrReportContaint = encoder.GetBytes(xslXml);
           Response.ClearContent();
           Response.ClearHeaders();
           Response.Buffer = true;
           Response.ContentType = ContentTypeExcel;
           Response.Charset = string.Empty;
           Response.Cache.SetCacheability(HttpCacheability.NoCache);
           Response.AddHeader(ContentDisposition, header);
           Response.BinaryWrite(arrReportContaint);
           Response.Flush();
           Response.End();
       }
Posted
Comments
Kornfeld Eliyahu Peter 11-Mar-14 7:40am    
Encoding isn't means translation...
Vinodh.B 11-Mar-14 7:49am    
CAn you please provide the alternative
Kornfeld Eliyahu Peter 11-Mar-14 7:53am    
If you can ask your question, I can try...
You question make no sense - in the title you talk about 'convert to another language', that I read as translation. In the code you play with character encoding, that will not translate nothing but can ruin your content...
So please be more specific on what you try and where you stuck...
Vinodh.B 11-Mar-14 7:54am    
Basically I want to create a Excel xml in Japan Language .
Kornfeld Eliyahu Peter 11-Mar-14 8:00am    
Do you mean you have Japanese text in it and want to save - or create an empty (new) one for Japanese?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900