473,382 Members | 1,252 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

open() and Arabic language

Hello ...

firstly , sorry for my bad English .

i have problem with open() function when i use it with file which name
in Arabic , the open() will not find the file , and i am sure the file
is exist .
so how i can solve this problem ?

Aug 13 '06 #1
3 2451
MaaSTaaR wrote:
Hello ...

firstly , sorry for my bad English .

i have problem with open() function when i use it with file which name
in Arabic , the open() will not find the file , and i am sure the file
is exist .
so how i can solve this problem ?
On this page http://www.amk.ca/python/howto/unicode , there is a brief
section near the bottom on "Unicode filenames". If your problem is
related to Unicode, this may help you, but I'm not sure.

HTH,
~Simon

Aug 13 '06 #2
MaaSTaaR wrote:
Hello ...

firstly , sorry for my bad English .

i have problem with open() function when i use it with file which name
in Arabic , the open() will not find the file , and i am sure the file
is exist .
so how i can solve this problem ?
probably a unicode problem. Good luck.
Aug 13 '06 #3
MaaSTaaR wrote:
Hello ...

firstly , sorry for my bad English .

i have problem with open() function when i use it with file which name
in Arabic , the open() will not find the file , and i am sure the file
is exist .
so how i can solve this problem ?
Provide more information -- a major factor is which operating system
[my crystal ball says that you are using Linux but it could be wrong].
Also an actual test case with a short file name. Here's an example with
a part-Chinese filename on a Windows machine, which just uses the
information in the Unicode HOWTO that you were pointed at by another
poster:

C:\junk\unicode_name>dir
[snip]
30/05/2006 09:25 AM 17 ??.txt
[snip]

# only 1 file in the directory; dir command mangles the displayed name

C:\junk\unicode_name>python
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
|>>import os
|>>os.listdir('.')
['??.txt']
|>>os.listdir(u'.')
[u'\u5f20\u654f.txt']

# filename is kept in Unicode, so we can open it that way

|>>f = open(u'\u5f20\u654f.txt')
|>>f.read()
'yadda yadda yadda'
# success

|>>import sys
|>>sys.getfilesystemencoding()
'mbcs'

.... I'm guessing that you will find that you have to encode the
filename in utf-8 then feed it to the open() function.

If you still have a problem, come back with exact (copy/paste) results
of both os.listdir() [the '.' and the u'.'], the
sys.getfilesystemencoding(), and your failed open() attempt.

Hope this helps,
John

Aug 14 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: suhaddad | last post by:
I have an XML schema that I want to modify. I need to change the text from English to Arabic, but I can't seem to be able to do so. <LearningResourceData Type="Session - Tutorial and Workouts">...
17
by: thinkfirst | last post by:
Hello CIWAH ... I want to propose full internationalization of three related websites: http://africadatabase.org/ http://people.africadatabase.org/ http://institutions.africadatabase.org/ My...
1
by: Dharmendra Singh | last post by:
Hi I'm using .Net(C#) and working on the form(Screen) which have text boxes for both arabic and english data to store. So i want to change the language at run time from arabic to english and...
0
by: bvcbb | last post by:
Dear all I am supposed to develop a world ready application in C# 2003 (which will run in xp) which should aupport Arabic & Hebrew also. My doubts(Fears) are: 1. Do i have to create all the...
0
by: Garrek | last post by:
I have an existing ASP.Net application that must be modified to support mixed content: Latin-based languages (i.e. English) intermixed with Arabic. Our code and database assumes everything is...
6
by: Michelle Stone | last post by:
Hi I am doing a bilingual .NET application for English/Arabic. On a web form, I have some edit boxes for data entry in Arabic and some for entry in English. Right now the user has to change his...
0
by: shizah | last post by:
First of all thanks alot for ur response. Let me clear my point again to u so that u can suggest me a better advice. Well sir u r very much right in this contrast that it can be implemented in my...
2
by: PrateekArora | last post by:
Hi Guys, I need to develop a MultiLingual Application (Arabic & English) in VB.NET, as far as Labels and captions are concerned in User Interface I am done with that using Resource Manager Class &...
2
JustRun
by: JustRun | last post by:
Hi, I'm developing a web application using ASP.NET2.0 with C#, I have tried to use custom validation controls to validate my forms, it worked very well in the English language , but when i test it...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.