-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: DeepakG_MSFT
Message 2 in Discussion
Hi Puri, Working with Encoding classes with scenarios like this can be a little
tricky.. Just remember that your "garbled" data corresponds to codepage 1252 (because
you are seeing "ASCII/English" characters). You need to map this data to codepage
1256. So you start with Encoding class corresponding to codepage 1252, get the
byte-array and then convert it to a string using codepage 1256. Here is the full dump:
<%@ page language="C#" %>
<%@ import namespace="System.Text" %>
<script runat="server">
//By Deepak Gulati Microsoft Corp. Oct 2003
void Page_Load(Object o, EventArgs e)
{
String ArabicEncoded = "�� ������� ���� ��� �����ء ����� ��� ������ ��� ���
����� ������ ��� ������� ����� ����� ����� ������ Microsoft. ������ �������������
������� ���� ������� Microsoft �� ����� ������ \" �����\" ����� ����� �� ������� ����
���� ����� �������� �������.NET Passport ������ ������ ������ ����� �� ��� �.NET";
String ArabicUnicode = "";
Byte[] ArabicTransition;
//Response.Write(ArabicEncoded);
Encoding EnglishEncoding = Encoding.GetEncoding(1252);
ArabicTransition = EnglishEncoding.GetBytes(ArabicEncoded);
Encoding ArabicEncoding = Encoding.GetEncoding(1256);
Response.Write(ArabicEncoding.GetString(ArabicTransition));
}
</script> <html>
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form runat="server"> </form>
</body>
</html>
Regards, Deepak
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]