Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4498
  • Last Modified:

Converting a utf-8 string to hebrew encoding

I have an ASP file that gets as parameter a utf-8 string of a hebrew word ( format is %D7%90 in utf-8 for the character that is %E0 in hebrew encoding ).
I would like to take that string which is in utf-8 and with ASP code convert it to a hebrew encoding string.  How can this be done in script ( prefereably without using outside components ), a code snippet would be appreciated.
0
ophirlotan
Asked:
ophirlotan
1 Solution
 
adinasCommented:
check this out:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML>
<HEAD>
<TITLE>Character Set Recognition</TITLE>

<META NAME=MS-HKWD CONTENT="Character Set Recognition">
<META NAME="Keywords" CONTENT="Dynamic HTML, DHTML, IE4, Internet Explorer 4.0">
<META NAME="Platform" CONTENT="Windows, Win95, WinNT, Mac">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso8859-1">
<META NAME="MS.LOCALE" CONTENT="EN-US">
<META NAME="ROBOTS" CONTENT="all">


<SCRIPT>
//<!--
var g_isIE = false, g_isNav = false, g_iMaj = 0, g_sPlat = "";
// -->
</SCRIPT>
<SCRIPT SRC="../../../code/ver.js"></SCRIPT>


<SCRIPT DEFER SRC="../../../code/common.js"></SCRIPT>
<SCRIPT DEFER>
//<!--
function InitPage()
{
      if (g_isIE && g_iMaj >= 4)      
      {
            SetTOC();
      }
}
//-->
</SCRIPT>

<LINK REL="stylesheet" HREF="/msdn/sdk/inetsdk/help/basicsdkIE4.css" TYPE="text/css">
<!-- STYLE_START -->


<SCRIPT>
//<!--
   var sVR = '../../../'      // Set root for the style sheet
   var sCSS = '<LINK REL="stylesheet" HREF="' + sVR;

   if(g_isIE)
   {
         if (g_iMaj >= 4) // For MSIE 4.0 or later
         {
               sCSS += 'basicSDKIE4';
               if (g_sPlat == "Win") // Windows only for now
               {
                     document.createStyleSheet(sVR + 'advSDKIE4.css');
               }
         }
         else // For MSIE 3.0 or earlier
         {
               sCSS += 'basicSDKIE3';
         }
   }
   else if (g_isNav) // For all Nav versions
   {
         sCSS += 'basicSDKNAV';
   }
   else
   {
         sCSS += 'basicSDKIE3'; // default to IE3 sheet
   }

   sCSS += (sCSS == '' ? '' : '.css" TYPE="text/css">');

   document.write(sCSS);
//-->
</SCRIPT>
<!-- STYLE_END -->
</HEAD>
<BODY onload="InitPage()" BGCOLOR="#FFFFFF">

<A NAME="pagetop"></A><A NAME="charsets4"></A>
<!-- NAV_LINKS_START -->
<TABLE class=main BORDER=0 CELLSPACING="0" CELLPADDING="0" WIDTH="10%"><TR><TD ROWSPAN="3" VALIGN="TOP" WIDTH="121"><IMG SRC="../../../art/headbar2.gif" WIDTH="121" HEIGHT="82" BORDER=0 ALT="Character Set Recognition"></TD><TD ROWSPAN="2" VALIGN="TOP" WIDTH="186"><IMG SRC="../../../art/headbara.gif" WIDTH="186" HEIGHT="44" BORDER=0 ALT="Character Set Recognition"></TD><TD VALIGN="TOP" WIDTH="470"><IMG SRC="../../../art/replace1.gif" WIDTH="470" HEIGHT="17" BORDER=0 ALT="*"></TD></TR>
<TR><TD><PRE><IMG SRC="../../../art/arrowrht.gif" WIDTH="14" HEIGHT="14" ALIGN="MIDDLE" BORDER=0 ALT="*"><object id="hhal_1" type="application/x-oleobject"
      classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<PARAM name="Command" value="ALink">
<PARAM name="Item1" value="">
<PARAM name="Item2" value=_win32_Contents>
</object><A STYLE="color:black" ID=TOC HREF=JavaScript:hhal_1.Click()>Contents</A>  <IMG SRC="../../../art/arrowrht.gif" WIDTH="14" HEIGHT="14" ALIGN="MIDDLE" BORDER=0 ALT="*"><object id="hhal_2" type="application/x-oleobject"
      classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<PARAM name="Command" value="ALink">
<PARAM name="Item1" value="">
<PARAM name="Item2" value=_win32_Index_1sz1>
</object><A STYLE="color:black" HREF=JavaScript:hhal_2.Click()>Index</A>  <IMG SRC="../../../art/arrowrht.gif" WIDTH="14" HEIGHT="14" ALIGN="MIDDLE" BORDER=0 ALT="*"><A STYLE="color:black" HREF="charsets.htm#ie40_charsets">Topic Contents</A></PRE></TD></TR>
<TR><TD COLSPAN="2"><PRE><IMG SRC="../../../art/arrowlft.gif" WIDTH="17" HEIGHT="15" ALIGN="MIDDLE" BORDER=0 ALT="*"><B>Previous Topic:</B> <A STYLE="color:black" HREF="charset3.htm">Character Entities for Special Symbols and BIDI Text</A>
<IMG SRC="../../../art/arrownxt.gif" WIDTH="17" HEIGHT="16" ALIGN="MIDDLE" BORDER=0 ALT="*"><B>Next Topic:</B> <A  STYLE="color:black" HREF="../cssrefs.htm">CSS Attributes Reference</A></PRE></TD></TR>
</TABLE>
<!-- NAVLINKS_END -->
<BLOCKQUOTE class="body">
<!-- CONTENTS_START -->
<H1>Character Set Recognition</H1>
<BR CLEAR=ALL>
<P>Internet Explorer uses the character set specified for a document to determine how to translate the bytes in the document into characters on the screen or paper. By default, Internet Explorer uses the character set specified in the HTTP content type returned by the server to determine this translation. If this parameter is not given, Internet Explorer uses the character set specified by the <A HREF="../html/META.htm#META">META</A> element in the document. It uses the user's preferences if no <B>META</B> element is given.

<P>You can use the <A HREF="../html/META.htm#META">META</A> element to explicitly set the character set for a document. In this case, you set the <A HREF="../html/META.htm#HTTP_EQUIV_">HTTP-EQUIV=</A> attribute to "Content-Type" and specify a character set identifier in the <A HREF="../html/META.htm#CONTENT_">CONTENT=</A> attribute. For example, the following <B>META</B> element identifies Windows-1251 as the character set for the document.

<PRE>&lt;META HTTP-EQUIV="Content-Type"
  CONTENT="text/html; CHARSET=Windows-1251"&gt;
</PRE>

<P>As long as you place the <A HREF="../html/META.htm#META">META</A> element before the <A HREF="../html/BODY.htm#BODY">BODY</A> element, it affects the whole document, including the <A HREF="../html/TITLE.htm#TITLE">TITLE</A> element. For clarity it should appear as the first element after <A HREF="../html/HEAD.htm#HEAD">HEAD</A> so that all readers know the encoding before the first displayable is parsed. Note that the <B>META</B> element applies to the document containing it. This means, for example, that a compound document (a document consisting of two or more documents in a set of frames) can use different character sets in different frames.

<P>
<TABLE>
<TR><TD><B>Windows <NOBR>Codepage #</NOBR> </B></TD><TD><B>Display name </B></TD><TD><B><NOBR>Preferred ID</NOBR> on SAVE </B></TD><TD><B>Internet Explorer 4 Aliases</B></TD></TR>
<TR><TD>1252 </TD><TD>Western </TD><TD>iso-8859-1<BR>except when 128-159 is used, use "Windows-1252" </TD><TD>iso8859-1, iso_8859-1, iso-8859-1, ANSI_X3.4-1968, iso-ir-6, ANSI_X3.4-1986, ISO_646, irv:1991, ISO646-US, us, IBM367, cp367, csASCII, latin1, iso_8859-1:1987, iso-ir-100, ibm819, cp819, Windows-1252 </TD></TR>
<TR><TD>20105 </TD><TD> </TD><TD>us-ascii </TD><TD>us-acii, ascii </TD></TR>
<TR><TD>28592 </TD><TD>Central European (ISO) </TD><TD>iso-8859-2 </TD><TD>iso8859-2, iso-8859-2, iso_8859-2, latin2, iso_8859-2:1987, iso-ir-101, l2, csISOLatin2 </TD></TR>
<TR><TD>1250 </TD><TD>Central European (Windows) </TD><TD>Windows-1250 </TD><TD>Windows-1250, x-cp1250 </TD></TR>
<TR><TD>1251 </TD><TD>Cyrillic (Windows) </TD><TD>Windows-1251 </TD><TD>Windows-1251, x-cp1251 </TD></TR>
<TR><TD>1253 </TD><TD>Greek (Windows) </TD><TD>Windows-1253 </TD><TD>Windows-1253 </TD></TR>
<TR><TD>1254 </TD><TD>Turkish (Windows) </TD><TD>Windows-1254 </TD><TD>Windows-1254 </TD></TR>
<TR><TD>932 </TD><TD>Japanese (Shift-JIS) </TD><TD>shift_jis </TD><TD>shift_jis, x-sjis, ms_Kanji, csShiftJIS, x-ms-cp932 </TD></TR>
<TR><TD>51932 </TD><TD>Japanese (EUC) </TD><TD>x-euc-jp </TD><TD>Extended_UNIX_Code_Packed_Format_for_Japanese, csEUCPkdFmtJapanese, x-euc-jp, x-euc </TD></TR>
<TR><TD>50220 </TD><TD>Japanese (JIS) </TD><TD>iso-2022-jp </TD><TD>csISO2022JP, iso-2022-jp </TD></TR>
<TR><TD>1257 </TD><TD>Baltic (Windows) </TD><TD>Windows-1257 </TD><TD>windows-1257 </TD></TR>
<TR><TD>950 </TD><TD>Traditional Chinese (BIG5) </TD><TD>big5 </TD><TD>big5, csbig5, x-x-big5 </TD></TR>
<TR><TD>936 </TD><TD>Simplified Chinese (GB2312) </TD><TD>gb2312 </TD><TD>GB_2312-80, iso-ir-58, chinese, csISO58GB231280, csGB2312, gb2312 </TD></TR>
<TR><TD>20866 </TD><TD>Cyrillic (KOI8-R) </TD><TD>koi8-r </TD><TD>csKOI8R, koi8-r </TD></TR>
<TR><TD>949 </TD><TD>Korean (KSC5601) </TD><TD>ks_c_5601 </TD><TD>ks_c_5601, ks_c_5601-1987, korean, csKSC56011987 </TD></TR>
<TR><TD>1255 (logical) </TD><TD>Hebrew (ISO-logical) </TD><TD>Windows-1255 </TD><TD>iso-8859-8i </TD></TR>
<TR><TD>1255 (visual) </TD><TD>Hebrew (ISO-Visual) </TD><TD>iso-8859-8 </TD><TD>ISO-8859-8 Visual, ISO-8859-8 , ISO_8859-8, visual </TD></TR>
<TR><TD>862 </TD><TD>Hebrew (DOS) </TD><TD>dos-862 </TD><TD>dos-862 </TD></TR>
<TR><TD>1256 </TD><TD>Arabic (Windows) </TD><TD>Windows-1256 </TD><TD>Windows-1256  </TD></TR>
<TR><TD>720 </TD><TD>Arabic (DOS) </TD><TD>dos-720 </TD><TD>dos-720 </TD></TR>
<TR><TD>874 </TD><TD>Thai </TD><TD>Windows-874 </TD><TD>Windows-874 </TD></TR>
<TR><TD>1258 </TD><TD>Vietnamese </TD><TD>Windows-1258 </TD><TD>Windows-1258 </TD></TR>
<TR><TD>65001 </TD><TD>Unicode UTF-8 </TD><TD>UTF-8 </TD><TD>UTF-8, unicode-1-1-utf-8, unicode-2-0-utf-8 </TD></TR>
<TR><TD>65000 </TD><TD>Unicode UTF-7 </TD><TD>UNICODE-1-1-UTF-7 </TD><TD>utf-7, UNICODE-1-1-UTF-7, csUnicode11UTF7, utf-7 </TD></TR>
<TR><TD>50225 </TD><TD>Korean (ISO) </TD><TD>ISO-2022-KR </TD><TD>ISO-2022-KR, csISO2022KR </TD></TR>
<TR><TD>52936 </TD><TD>Simplified Chinese (HZ) </TD><TD>HZ-GB-2312 </TD><TD>HZ-GB-2312 </TD></TR>
<TR><TD>28594 </TD><TD>Baltic (ISO) </TD><TD>iso-8869-4 </TD><TD>ISO_8859-4:1988, iso-ir-110, ISO_8859-4, ISO-8859-4, latin4, l4, csISOLatin4 </TD></TR>
<TR><TD>28585 </TD><TD>Cyrillic (ISO) </TD><TD>iso_8859-5 </TD><TD>ISO_8859-5:1988, iso-ir-144, ISO_8859-5, ISO-8859-5, cyrillic, csISOLatinCyrillic, csISOLatin5 </TD></TR>
<TR><TD>28597 </TD><TD>Greek (ISO) </TD><TD>iso-8859-7 </TD><TD>ISO_8859-7:1987, iso-ir-126, ISO_8859-7, ISO-8859-7, ELOT_928, ECMA-118, greek, greek8, csISOLatinGreek </TD></TR>
<TR><TD>28599 </TD><TD>Turkish (ISO) </TD><TD>iso-8859-9 </TD><TD>ISO_8859-9:1989, iso-ir-148, ISO_8859-9, ISO-8859-9, latin5, l5, csISOLatin5 </TD></TR>
</TABLE>
<!-- CONTENTS_END -->
<!-- START PAGE FOOTER -->
<H6><HR size=1></H6>
<P><A ID=line HREF="#pagetop"><IMG src="../../../art/arrowup1.gif" WIDTH="17" HEIGHT="16" ALIGN="MIDDLE" BORDER="0" ALT="Up">&nbsp;Top of Page</A>
<BR><A ID=line HREF="http://www.microsoft.com/misc/cpyright.htm" TARGET="_top">&#169; 1997 Microsoft Corporation. All rights reserved. Terms of Use.</A>
<!-- END PAGE FOOTER -->
</BLOCKQUOTE>
</BODY>
</HTML>


0
 
ophirlotanAuthor Commented:
Comment accepted as answer
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now