Help me...
Hi dears. Mr.Tavakkolian was helping me until my function completed. This function converts utf8(digit) to integer. $farsi_table_linux=array(NONE, #1776;, #1777;, #1778;, #1779;, #1780;, #1781;, #1782;, #1783;, #1784;, #1785;); function search_index_array($str) { global $farsi_table; for ($i=0;$i11;$i++) { if ($farsi_table[$i]==$str ) return $i; } return FALSE; }// end of search_index_array function utf8_to_int($str) { $len=strlen($str); $out=; $char=explode(;,$str); for ($i=0;$i$len;$i++) { $char[$i].=;; if (search_index_array($char[$i])!=False) $out.=search_index_array($char[$i])-1; }//end of for ($i) return $out; }//end of utf8_to_int When i call utf8_to_int(#1776;.#1785;) ,this return 09 ,But When i enter a number(utf8) via keyboard,This function return 0. Please guide me that i how enter a number via keyboard(persian) i get true answer. --regards _ Thank you for choosing LinuxQuestions. http://www.linuxquestions.org ___ FarsiWeb mailing list [EMAIL PROTECTED] http://lists.sharif.edu/mailman/listinfo/farsiweb
Re: Help me...
Hi, As I mentioned in my original posting, I am not a PHP programmer; But, it seems that for keyboard input functions you WILL have to convert UTF-8 to HTML encoding if you want to use your function; for example by calling a function like htmlentities() or utf8_decode() before calling utf8_to_int(). The pseudo code looks like this: if (input is in UTF-8) {# for example input is from a Linux keyboard $str = htmlentities($str, ENT_COMPAT, UTF-8 ); } $intvalue = utf8_ot_int($str); I've included the function again; I added the extra code to check for x in set y test. Also note the use of the built-in strtr() function. These builtins usually are more efficient (written in C) and are faster. This code has not been tested. function utf8_to_int($str) { $transtbl = array ( #1776; = '0', #1777; = '1', #1778; = '2', #1779; = '3', #1780; = '4', #1781; = '5', #1782; = '6', #1783; = '7', #1784; = '8', #1785; = '9' ); foreach ($transtbl as $key = $value) { if ($key == $str) { # it has an HTML encoded numeric $str = strtr($str, $transtbl); # convert all of them to ASCII [0-9] return (int) $str; # convert to whole thing to integer } } return (int) $str; } One last thing, this function (and your version) has a fatal flaw. Do you want to guess what it is? Hint: What happens if the string is ABCDE? What is the difference in the return value from the function for the strings ABCD and #1776;? -Fariborz ---BeginMessage--- Hi dears. Mr.Tavakkolian was helping me until my function completed. This function converts utf8(digit) to integer. $farsi_table_linux=array(NONE, #1776;, #1777;, #1778;, #1779;, #1780;, #1781;, #1782;, #1783;, #1784;, #1785;); function search_index_array($str) { global $farsi_table; for ($i=0;$i11;$i++) { if ($farsi_table[$i]==$str ) return $i; } return FALSE; }// end of search_index_array function utf8_to_int($str) { $len=strlen($str); $out=; $char=explode(;,$str); for ($i=0;$i$len;$i++) { $char[$i].=;; if (search_index_array($char[$i])!=False) $out.=search_index_array($char[$i])-1; }//end of for ($i) return $out; }//end of utf8_to_int When i call utf8_to_int(#1776;.#1785;) ,this return 09 ,But When i enter a number(utf8) via keyboard,This function return 0. Please guide me that i how enter a number via keyboard(persian) i get true answer. --regards _ Thank you for choosing LinuxQuestions. http://www.linuxquestions.org ___ FarsiWeb mailing list [EMAIL PROTECTED] http://lists.sharif.edu/mailman/listinfo/farsiweb ---End Message--- ___ FarsiWeb mailing list [EMAIL PROTECTED] http://lists.sharif.edu/mailman/listinfo/farsiweb
Re: Help.....
The online document below has the information you need. http://us4.php.net/manual/en/function.utf8-encode.php The only thing that the code segment you sent seems to do is use the (int) cast to convert a string to an integer. It first tries to match the strings '#1776;' through '#1785;' against the input strings. If it matches, it casts the string to integer. PHP uses the standard C library function strtod() to do the cast. I suspect that PHP converts the HTML encoding back to UTF8 encoding (probably utf8_encode function) before calling strtod(); Basically '#1776;' becomes 0x6F0, etc.. Strtod() then tries to convert the string, paying attention to the locale and interprets the 0x6F0-0x6F9 unicode values as numeric 0-9; I don't know why it wouldn't work on all browsers. If you want details, continue reading. The script is very obfuscated. Starting with this array: ?php $farsi_table=array(4758678, 3835495459, #Zero 3835495559, #one 3835495659, #two 3835495759, #three 38354955564859, #four 38354955564959, #five 38354955565059, #six 38354955565159, #seven 38354955565259, #eight 38354955565359 #nine ); If you take the string 3835495459 (The #Zero element) and then convert it to two character sequences 38 35 49 55 55 54 59 and then lookup the those ordinal positions in an ASCII table -- the 38th ASCII character is '', the 35th is '#', the 49th is '1', the 55th is '7', etc. -- you'll see that these strings are just representing the ascii values for ' # 1 7 7 6 ;' in decimal! Why not just leave those as #1776;, etc. The string '#1776;' as you all know, is the HTML notation for specifying a character that can't be typed for whatever reason. In this case this is the representation of the UNICODE value 0x6F0 which is extended arabic-indic digit zero. The others follow the same logic, all the way to #1785;. The function utf8_to_int() is in fact not a UTF8-to-int conversion, but an HTML-encoding-of-UTF8-to-int conversion. I think the following will do what you want, and it might help avoid problems with strtod() versions that might not be unicode safe. function utf8_to_int($str) { $transtbl = array ( #1776; = '0', #1777; = '1', #1778; = '2', #1779; = '3', #1780; = '4', #1781; = '5', #1782; = '6', #1783; = '7', #1784; = '8', #1785; = '9' ); # Could add the following line to make sure that # the string is HTML encoded first # $str = htmlentities($str, ENT_COMPAT, UTF-8 ); $str = strtr($str, $transtbl); return (int) $str; } Disclaimer: I have not tested the code above and in fact I've never written a PHP script before tonight. I spent a few hours reading the language manual and looking at the sources tonight. I can't guarantee the results :) -Fariborz ___ FarsiWeb mailing list [EMAIL PROTECTED] http://lists.sharif.edu/mailman/listinfo/farsiweb
Help.....
Hi daers.Mohsen Pahlevanzadeh studing computer in my university.Mohsen Pahlevanzadeh wrote a function what converts utf8 to digit.It means that you enter 30(farsi),this function return 30(latin).Then you can corprate this number in computing.He tested with RedHat 9 with iranian keyboard layout.He told me that he don't know that this function work with IE.He tested on Mozilla got true answer. I tesed on IE but i got false answer.Of course,I don't know PHP or webprogramming.I ask you test this function on IE tell me your answer.If your answer will become true,tell me how to its usage.Becuse i need to this function.You can see that function in following lines:?php$farsi_table=array("4758678", "3835495459", #Zero "3835495559", #one "3835495659", #two "3835495759", #three "38354955564859", #four "38354955564959", #five "38354955565059", #six "38354955565159", #seven "38354955565259", #eight "38354955565359" #nine );function search_index_array($str){global $farsi_table;for ($i=0;$i11;$i++) { if ($farsi_table[$i]==$str) return $i; } return FALSE;}// end of search_index_arrayfunction utf8_to_int($str){ global $farsi_table; $len=strlen($str);# / 7; $char=unpack("C*",$str); $out=""; for ($i=0;$i$len;$i++) { $tmp=$char[$i].$char[$i+1].$char[$i+2].$char[$i+3].$char[$i+4].$char[$i+5].$char[$i+6]; if (search_index_array($tmp)!=False) $out.=search_index_array($tmp)-1; } return (int)$out;}? --Yours,Shahnaz. Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software___ FarsiWeb mailing list [EMAIL PROTECTED] http://lists.sharif.edu/mailman/listinfo/farsiweb
Help Me too
Hi Dear members. If u used PHPBB ,tell me how I can pass username and password of my site to session and cookie of PHPBB... and give me an example to make a session and cookie with php... Best regards Mahmood Reza Delfieh ___ FarsiWeb mailing list [EMAIL PROTECTED] http://lists.sharif.edu/mailman/listinfo/farsiweb
help--utf8 to integer
Dear members.I got a function what it converts int to utf8.This means if you enter 27,function returns 25,But utf8. I need to the function what it perform reverse of pervious function.This means you enter 27(utf8) function returns 27(int). I have searched on net i get following function: ?php //=== $table = array ( \x30 = \xDB\xB0, # Persian 0 \x31 = \xDB\xB1, # Persian 1 \x32 = \xDB\xB2, # Persian 2 \x33 = \xDB\xB3, # Persian 3 \x34 = \xDB\xB4, # Persian 4 \x35 = \xDB\xB5, # Persian 5 \x36 = \xDB\xB6, # Persian 6 \x37 = \xDB\xB7, # Persian 7 \x38 = \xDB\xB8, # Persian 8 \x39 = \xDB\xB9, # Persian 9 ); //= //= function utf8 ( $str_in ) { global $table; $html_command = false; $str_out=; foreach ( preg_split ( '//' , $str_in ) as $char ) { if ( $table[$char] !$html_command ) { $str_out .= $table[$char]; }else { $str_out .= $char; } if ( $char == '' ) $html_command = true ; if ( $char == '' ) $html_command = false ; } return $str_out; } //= ? Function of up,converts int to utf8. Please help mePlease -Shahnaz __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com ___ FarsiWeb mailing list [EMAIL PROTECTED] http://lists.sharif.edu/mailman/listinfo/farsiweb
please help! HTML Numeric Characters
Hi How can I convert HTML Unicode Numeric Characters like #1504; to their simple unicode form using VB/ASP? You can found two PHP functions for encoding and decoding these numeric characters, in the following addresses. I want the same thing but in VB or VBScript: http://marty.anstey.ca/programming/php/function.mb-encode-numericentity.html http://marty.anstey.ca/programming/php/function.mb-decode-numericentity.html Thanks, Sina Ahmadian http://www.30na.com _ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail ___ FarsiWeb mailing list [EMAIL PROTECTED] http://lists.sharif.edu/mailman/listinfo/farsiweb
[farsiweb]HELP
Hi dears.I have RedHat 7.3. I built a rpm file via msttcorefonts-1.3-3.spec script. installed it rpm file until i can see type farsi.But i can type farsi only with XEmac,however i type farsi with uppercase characters.I can't swicth to lowercase characters. Please guide me until i can type farsi with gedit i can swicth to lowrcase characters. I'm waitting your guide --Best regards _ Thank you for choosing LinuxQuestions. http://www.linuxquestions.org _ Select your own custom email address for FREE! Get [EMAIL PROTECTED] w/No Ads, 6MB, POP more! http://www.everyone.net/selectmail?campaign=tag ___ FarsiWeb mailing list [EMAIL PROTECTED] http://lists.sharif.edu/mailman/listinfo/farsiweb
[farsiweb]unicode with PHP help
Dear Sir,, I found your email in php forum,,my casewith Arabic characters ... I have Arabic content stored in MS access and need to deliver it by wml pages. arabic mobile enabled support UTF-8Unicode format so how can I getmy content in this format using PHP code. my system configuration is : windows 2k with Arabic character setinstalled apache web server php scripting language MSAccess database Hope to hear from you soon. Thanx Help STOP SPAM with the new MSN 8 and get 2 months FREE* ___ FarsiWeb mailing list [EMAIL PROTECTED] http://lists.sharif.edu/mailman/listinfo/farsiweb
[farsiweb]PLEASE HELP ME MR.roozbeh poornaderK IN KBDFA.DLL IN XP
HELLO MR.roozbeh poornader CAN I USE KBDFA.DLL IN WINDOWS XP PLEASE ANSWER SOON THANK YOU VERY MUCH GOOD LUCK Do you Yahoo!? Yahoo! Shopping - Send Flowers for Valentine's Day
[farsiweb]i need some help (maryamdd)
You may want to visit this site: http://www.parspendar.net/ They deal mainly with Farsi in Foxpro. good luck, Saeed. Send FarsiWeb mailing list submissions to [EMAIL PROTECTED] To subscribe or unsubscribe via the World Wide Web, visit http://lists.sharif.edu/mailman/listinfo/farsiweb or, via email, send a message with subject or body 'help' to [EMAIL PROTECTED] You can reach the person managing the list at [EMAIL PROTECTED] When replying, please edit your Subject line so it is more specific than Re: Contents of FarsiWeb digest... Today's Topics: 1. i need some help (maryamdd) --__--__-- Message: 1 From: maryamdd [EMAIL PROTECTED] To: [EMAIL PROTECTED] Date: Fri, 14 Feb 2003 22:37:39 +0330 Subject: [farsiweb]i need some help This is a multi-part message in MIME format. --=_NextPart_000_0005_01C2D479.ADEEB9B0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable hello =20 i am doing a project now=20 i have a problem doing it=20 the subject of the project : there is a program writen in foxpro with iran system farsi maker. = naturally it is under dos operating system now i need some reports and diagrams of it under windows operating = system with visual fox=20 but i can't convert the farsi fonts and the result is not useful for = me if you can help me in some way ,please send your answer to my email = address : [EMAIL PROTECTED] --=_NextPart_000_0005_01C2D479.ADEEB9B0 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN HTMLHEAD META http-equiv=3DContent-Type content=3Dtext/html; = charset=3Diso-8859-1 META content=3DMSHTML 6.00.2600.0 name=3DGENERATOR STYLE/STYLE /HEAD BODY bgColor=3D#ff DIVFONT face=3DArial size=3D2hellonbsp; /FONT/DIV DIVi am doing a projectnbsp; now /DIV DIVFONT face=3DArial size=3D2i have a problemnbsp;nbsp;doing it = /FONT/DIV DIVFONT face=3DArial size=3D2the subject of thenbsp;project = :/FONT/DIV DIVFONT face=3DArial size=3D2there is a program writen in foxpro = with iran=20 system farsi maker. naturally it is under dos operating = system/FONT/DIV DIVFONT face=3DArial size=3D2now i need some reports and diagrams of = it under=20 windows operating system with visual fox /FONT/DIV DIVFONT face=3DArial size=3D2butnbsp; i can'tnbsp; convert the = farsi fonts and=20 the result is not useful for me/FONT/DIV DIVFONT face=3DArial size=3D2if you can help me in some way ,please = send your=20 answer to my email address :/FONT/DIV DIVFONT face=3DArial size=3D2[EMAIL PROTECTED]/FONT/DIV DIVFONT face=3DArial size=3D2/FONTnbsp;/DIV/BODY/HTML --=_NextPart_000_0005_01C2D479.ADEEB9B0-- --__--__-- ___ FarsiWeb mailing list [EMAIL PROTECTED] http://lists.sharif.edu/mailman/listinfo/farsiweb End of FarsiWeb Digest ___ FarsiWeb mailing list [EMAIL PROTECTED] http://lists.sharif.edu/mailman/listinfo/farsiweb
[farsiweb]i need some help
hello i am doing a project now i have a problemdoing it the subject of theproject : there is a program writen in foxpro with iran system farsi maker. naturally it is under dos operating system now i need some reports and diagrams of it under windows operating system with visual fox but i can't convert the farsi fonts and the result is not useful for me if you can help me in some way ,please send your answer to my email address : [EMAIL PROTECTED]
[farsiweb]Pls help me...
Hi, Pls help me convert Zarnegar files to MS WORD Document. Ali ___ FarsiWeb mailing list [EMAIL PROTECTED] http://lists.sharif.edu/mailman/listinfo/farsiweb