Re: Translation

2003-10-04 Thread Skip Tavakkolian
> "vaaset" is so common.  The problem should be kind of Arabic vs
> Ferdowsi. ;)

I find this discussion very educational.  Isn't this problem easier to
handle in Arabic than in Farsi?  From my limited knowledge of Arabic,
it seem that, because Arabic's diction and vocabulary are in harmony
with its grammar, inventing new words are a matter of straight forward
application of existing rules; that is also exactly the reason why it is
hard in Farsi.

___
FarsiWeb mailing list
[EMAIL PROTECTED]
http://lists.sharif.edu/mailman/listinfo/farsiweb


Re: Translation

2003-10-03 Thread Skip Tavakkolian
> Contrary to your teacher's comment "shAresh" (flux) is
> "bA pedar o mAdar" because it comes from the Persian
> simple verb "shAridan" means "jAri budan".

I remember it being spelled sheen, alef, re.   This is around
'77, '78 when a new set of books came out.

___
FarsiWeb mailing list
[EMAIL PROTECTED]
http://lists.sharif.edu/mailman/listinfo/farsiweb


Re: Translation

2003-10-03 Thread Skip Tavakkolian
> Does any one knows a translation for"BOOKMARK" or"BOOKMARK THIS PAGE"
> in Persian?

neshaane safheh or neshaane ketab?

I don't know if such a phrase is actually in common use.  Reminds me of
my highschool physics teacher trying to explain where the word "shaar"
(a replacement for "flux") came from.  After thinking about it, he said,  it
comes from "Farsie be pedar o madar".

___
FarsiWeb mailing list
[EMAIL PROTECTED]
http://lists.sharif.edu/mailman/listinfo/farsiweb


Re: Help me...

2003-09-07 Thread Skip Tavakkolian
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 (
"۰" => '0',
"۱" => '1',
"۲" => '2',
"۳" => '3',
"۴" => '4',
"۵" => '5',
"۶" => '6',
"۷" => '7',
"۸" => '8',
"۹" => '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 "۰"?

-Fariborz
--- Begin Message ---
Hi dears.
Mr.Tavakkolian was helping me until my function completed.
This function converts utf8(digit) to integer.
$farsi_table_linux=array("NONE",
"۰",
"۱",
"۲",
"۳",
"۴",
"۵",
"۶",
"۷",
"۸",
"۹");
function search_index_array($str)
{
 global $farsi_table;
 
 for ($i=0;$i<11;$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("۰"."۹") ,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.....

2003-09-05 Thread Skip Tavakkolian
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 '۰' through '۹' 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 '۰'
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:

>  $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 "۰", etc.

The string '۰' 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 "۹".  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 (
"۰" => '0',
"۱" => '1',
"۲" => '2',
"۳" => '3',
"۴" => '4',
"۵" => '5',
"۶" => '6',
"۷" => '7',
"۸" => '8',
"۹" => '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


Re: [farsiweb]YEH problem decision [OFFTOPIC]

2003-03-18 Thread Skip Tavakkolian
> Yes you can. That was exactly what happened to OEone, where FSF 
> prohibited us from providing bash, glibc (and therefore all of our 
> distro, since we used glibc) because of a breach we did from GPL (it is 
> now resolved). So, in practice what happens is that MSFT's lawyers would 
> contact the owner of that SF project, and tell them to 'cease and 
> desist' since still they own the distributed material, and they can 
> change terms of service, much like a leased car, or apartment. Just like 
> that.

There was a breach of the original contract (i.e. GPL version that governed
your bash/glibc sources), so all bets are off. That is to say, one party
has already broken the contract, so it can't expect the other party (FSF) to
live by the terms of that same contract;  If the grantee was never
in breach of the original contract, FSF couldn't rescind the rights
given to the grantee in the GPL.

-Fariborz

___
FarsiWeb mailing list
[EMAIL PROTECTED]
http://lists.sharif.edu/mailman/listinfo/farsiweb


Re: [farsiweb]Re: FarsiWeb digest, Vol 1 #189 - 1 msg

2002-11-10 Thread Skip Tavakkolian
On Sat Nov  9 2002, [EMAIL PROTECTED] wrote:
> Hi,
> 
>> All these problems with the Arabic script makes me a believer in changing our 
>alphabet to a Latin-based >one and getting rid of all these unnecessary headaches :-) 
>>...
>>
>>-Fariborz
> 
> 
> There may be some other better ways for easy life :)
> 
> bye,
> Hamid

For the record, I wasn't the source of that gem of a statement.  I was
making the counter argument -- which were reduced to three little dots :)
And I agree, there are better ways to make life easy.

-Fariborz

___
FarsiWeb mailing list
[EMAIL PROTECTED]
http://lists.sharif.edu/mailman/listinfo/farsiweb



Re: [farsiweb]unicode fields in database

2002-11-10 Thread Skip Tavakkolian
ON SAT NOVEMBER  9 2002  [EMAIL PROTECTED] WROTE:
> Still, I'm curious. How come everyone on this discussion board is using the
> Latin alphabet? :-)


Well, most discussions here are also in English.  Should everyone in
Iran switch over to English?

Going back to the original point, would you explain how switching to
the Latin alphabet solves the Farsi text sorting problem in a database?

___
FarsiWeb mailing list
[EMAIL PROTECTED]
http://lists.sharif.edu/mailman/listinfo/farsiweb



Re: [farsiweb]unicode fields in database

2002-11-09 Thread Skip Tavakkolian
> All these problems with the Arabic script makes me a believer in changing our 
>alphabet to a Latin-based one and getting rid of all these unnecessary headaches :-) 

It is much easier to make the changes to the software to add the sorting
rules of a new coding than it would be to retrain 70M+ people.

BTW, what you suggest would transfer the problem somewhere else. So many
of the words in Farsi are from Arabic base that in order to preserve the etymology
of the words, you are forced to devise a one-to-one mapping of chars in
Arabic glyph form to Latin form.  So now you have the sorting problem somewhere
else.

I don't believe changing the char set would offer you any advantages
either.  I don't know if anyone would say that the state of comp.
sci.  or automation is markedly better in Turkey vs.  Iran, for
example.  Turkey adopted the Latin char set some 70 years ago.  It is
interesting to observe, when visiting historical sites in Turkey, that
most Turks can't read the poetry that is inscribed in stone in so many
mosques and palaces.  Sad indeed.  Not adopting a Latin char set has
not hurt Japan.

-Fariborz

___
FarsiWeb mailing list
[EMAIL PROTECTED]
http://lists.sharif.edu/mailman/listinfo/farsiweb



Re: [farsiweb]LEX

2002-10-27 Thread Skip Tavakkolian
Have you tried the cygwin package?  It is a collection of GNU packages
that have been ported to windows.  It contains Bison (GNU's version of
YACC) which is the compiler generator and Lex which a lexical analyzer
generator.  You'll find it at http://www.cygwin.com

There is also a commercial system called U/Win by David Korn at:
http://www.research.att.com/sw/tools/uwin
It contains YACC.

-Fariborz

> Hi,
> I am looking for a versian of LEX (compiler genator) for windows!
> If you know ,plz write it down to me.
> Best Regards,
>  
>  
> Mohammad Nazari Noughabi
> www.stipimen.4t.com
> [EMAIL PROTECTED]
>  



___
FarsiWeb mailing list
[EMAIL PROTECTED]
http://lists.sharif.edu/mailman/listinfo/farsiweb



Re: [farsiweb]Farsi in Mozilla

2002-10-02 Thread Skip Tavakkolian

Has he tried http://www.parsimail.com or http://www.neda.net/mail ?
Both have Java applets to handle the Farsi input. He would need to
install the font that has the glyphs for Unicode Arabic+Farsi ranges.

BTW, a quick search on Google shows that there are several other
email services in addition to the aforementioned.  On
http://directory.google.com follow the links below:

Regional > Middel East > Iran > Business and Economy > Internet > Email

Hope this helps.
-Fariborz

> Hi there:
> A guy asked me if it is possible to type Farsi in Mozilla. He told me that he 
> wants to write some of his letters in Farsi using Mozilla. I told him as far 
> as I know, Farsi support in Mozilla is not complete yet and one can only 
> partially type Farsi in Mozilla. However I was not sure of the answer, so I 
> decided to ask the group.
> Is there anyway to type Farsi in Moziila? Any patches or tweaks? On my RedHat 
> Linux 7.3, Though the keyboard layout and everything els is correct (I am 
> able to type Farsi on some programs like kword,) I am not able to type Farsi 
> in Mozilla. This guy has got SuSe Linux 8.0 and Windows 2000 installed on his 
> compueter.
> 
> Cheers
> -- 
> FarsiKDE on GNU/Linux
> http://www.farsikde.org
> 
> Aryan
> ___
> FarsiWeb mailing list
> [EMAIL PROTECTED]
> http://lists.sharif.edu/mailman/listinfo/farsiweb

___
FarsiWeb mailing list
[EMAIL PROTECTED]
http://lists.sharif.edu/mailman/listinfo/farsiweb