473,586 Members | 2,776 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2471
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\u 654f.txt')
|>>f.read()
'yadda yadda yadda'
# success

|>>import sys
|>>sys.getfiles ystemencoding()
'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.getfilesyst emencoding(), 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
3736
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"> I want to display the Type attribute in Arabic characters. How can I do that using Unicode or whatever else works? HELP! I am new to XML.
17
8328
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 role is mainly advisory and server management. I have very little to do with content or page generation, so it's not something I can do myself -- I...
1
3304
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 vice-versa, when the control moves from one text box to another. Regards Dharmendra
0
453
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 forms, message boxes in Arabic also. Does it mean that my application will have duplicate forms. One for Arabic and One for Non-Arabic. I am planning...
0
1606
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 UTF-8. I have some concerns on this and would appreciate feedback. 1) Displaying the english content requires left-to-right formatting ( left...
6
3096
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 keyboard language by pressing ALT+SHIFT (or by changing the language manually elsewhere) each time he wants to shift from one language to another.
0
1038
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 pc. Look only i m anaware of this thing to write text into the text box with shift+alt key. A normal user is unaware of it. if I upload pages into...
2
5436
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 & resource File (Code given below). But I am having issue with text boxes as we need them for both English as well as Arabic (depending upon the...
2
1704
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 with Arabic it didn't cause the validator consider the Arabic characters as Special Characters (. - ' " ...) which i prevent them in my forms. Is...
0
7911
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7839
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7954
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8215
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6610
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1179
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.