WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.



Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

UrlEncode of Hebrew characters

It turns out that the iUrlEncode and iContentUrl function in the WinInet extender may not properly UrlEncode some foreign character sets, such as Arabic and Hebrew.

The attached code helps in replicating the iURLEncode and iContentUrl functions for the Hebrew characterset.

From: Yossi_Shalev

;encode the query data to url format
#DefineFunction QueryEncode( QueryString )
   Heb="    ö                  ä    "
   ;UrlHeb ="%D7%90+%D7%91+%D7%92+%D7%93+%D7%94+%D7%95+%D7%96+%D7%97+%D7%98+%D7%99+%D7%9A+%D7%9B+%D7%9C+%D7%9D+%D7%9E+%D7%9F+%D7%A0+%D7%A1+%D7%A2+%D7%A3+%D7%A4+%D7%A5+%D7%A6+%D7%A7+%D7%A8+%D7%A9+%D7%AA"
   UrlHeb ="%%D7%%90+%%D7%%91+%%D7%%92+%%D7%%93+%%D7%%94+%%D7%%95+%%D7%%96+%%D7%%97+%%D7%%98+%%D7%%99+%%D7%%9A+%%D7%%9B+%%D7%%9C+%%D7%%9D+%%D7%%9E+%%D7%%9F+%%D7%%A0+%%D7%%A1+%%D7%%A2+%%D7%%A3+%%D7%%A4+%%D7%%A5+%%D7%%A6+%%D7%%A7+%%D7%%A8+%%D7%%A9+%%D7%%AA"
   sSize = StrLen( QueryString )
   UrlTranslated = ""
   HebCount=ItemCount( UrlHeb, "+" )+1
   For u=1 To sSize
      cChar = StrSub( QueryString, u, 1 ) 
      hPos = ItemLocate( cChar, Heb, " " )
      If hPos!=0
         UrlTranslated=StrCat(UrlTranslated, ItemExtract( HebCount-hPos, UrlHeb, "+" ) )
         UrlTranslated=StrCat(UrlTranslated, cChar)
   Drop( Heb, UrlHeb, sSize, cChar, hPos )

Return UrlTranslated

Article ID:   W15876
File Created: 2017:07:28:13:58:49
Last Updated: 2011:05:13:13:53:30