Hello All:
I have a windows application that I need to encode a string using Unicode.
The example I have been given to use is a Web-Version. Below is the webcode.
Response.Conten tEncoding=Syste m.Text.Encoding .Unicode;
Response.Conten tType = "applicatio n/postscript";
Response.Buffer =true;
Response.Append Header("Content-Disposition","a ttachment; filename=\"" +
sFilename + "\"");
Byte[] ba = System.Text.Enc oding.Unicode.G etBytes(sPSFile );
Byte[] by = new System.Byte[1];
for(int i=0;i<ba.Length ;i+=2)
{
by[0]=ba[i];
Response.Binary Write(by);
}
Response.End();
I am having a hard time converting this code into the windows equivalent so
that the files remain the same. Would anyone be able to help?
I know what I am trying is not working. I thought I had to start down this
path:
Byte[] ba = System.Text.Enc oding.Unicode.G etBytes(postScr ipt);
UnicodeEncoding encoding = new UnicodeEncoding ();
postScript = encoding.GetStr ing(ba);
But I know the encoding.GetStr ing() simply converts it back to a string.
How do I get the value postScript to be the encoded value?
Thanks
Andy
I have a windows application that I need to encode a string using Unicode.
The example I have been given to use is a Web-Version. Below is the webcode.
Response.Conten tEncoding=Syste m.Text.Encoding .Unicode;
Response.Conten tType = "applicatio n/postscript";
Response.Buffer =true;
Response.Append Header("Content-Disposition","a ttachment; filename=\"" +
sFilename + "\"");
Byte[] ba = System.Text.Enc oding.Unicode.G etBytes(sPSFile );
Byte[] by = new System.Byte[1];
for(int i=0;i<ba.Length ;i+=2)
{
by[0]=ba[i];
Response.Binary Write(by);
}
Response.End();
I am having a hard time converting this code into the windows equivalent so
that the files remain the same. Would anyone be able to help?
I know what I am trying is not working. I thought I had to start down this
path:
Byte[] ba = System.Text.Enc oding.Unicode.G etBytes(postScr ipt);
UnicodeEncoding encoding = new UnicodeEncoding ();
postScript = encoding.GetStr ing(ba);
But I know the encoding.GetStr ing() simply converts it back to a string.
How do I get the value postScript to be the encoded value?
Thanks
Andy
Comment