| | |
line drawing characters not displayed properly - python unicode
![]() |
•
•
Join Date: Nov 2007
Posts: 2
Reputation:
Solved Threads: 0
hello,
I am very new to python scripting and would require some help. Thers a product
called Ajaxterm which makes use of python scripts and Ajax that I am using. It's a web based unix terminal emulator. I have set this up to work correctly. But there are some unicode related issues thats coming when using this product.
Let me elaborate much on this product for better understanding. this product makes python to interact with the Unix os, takes the output, generates an xml and displays it on a webpage by making use of ajax. so, to use this product we need to run a python file which acts as the server and a user can use http//myserver:myport from a client machine and access the unix box.
This is what I am trying to do: After logging in with my user id, I am trying to do a database login in my unix box. when i use putty, the login screen comes up as the pic1 in the attachment (Expected). but, when i use the terminal emulator (ajaxterm), it comes up like in the pics (Actual).
I have pinpointed to the code where this happens. the code is:
As far as i understood, 't' makes an instance of the current terminal, 'str' contains the reply that the python script takes from the unix os to pass it to the web terminal. till now, 'str' would still give me the wrong line drawing character (checked by printing str on the console)
but, I changed the code for 'str' to the following
and could see that 'str' prints the proper unicode line drawing characters as expected on the console.
the line 3 in the original code makes the 'str' to write to the webterminal. but, when i print 't'
on the console, it does still have the incorrect line drawing characters ('t' finally gets printed on the web console).
What am i doing wrong? I assume that 'str' automatically gets changed to the encoding that 't' is using when 't.write(str)' is encountered. I tried doing a
in the python code and i could see that prining the defaultencoding is giving me 'UTF-8'.
I am not sure what I am doing wrong. maybe i am not understanding what exactly
the lines
t=(self.proc[fd]['term']) and t.write(str) does or how i could manipulate it to make it work as expected. I tried to seach on this on the web, but didnt get much of help.
Sorry for the long description, but I'd really appreciate if anyone could help me on this.
Thank you.
I am very new to python scripting and would require some help. Thers a product
called Ajaxterm which makes use of python scripts and Ajax that I am using. It's a web based unix terminal emulator. I have set this up to work correctly. But there are some unicode related issues thats coming when using this product.
Let me elaborate much on this product for better understanding. this product makes python to interact with the Unix os, takes the output, generates an xml and displays it on a webpage by making use of ajax. so, to use this product we need to run a python file which acts as the server and a user can use http//myserver:myport from a client machine and access the unix box.
This is what I am trying to do: After logging in with my user id, I am trying to do a database login in my unix box. when i use putty, the login screen comes up as the pic1 in the attachment (Expected). but, when i use the terminal emulator (ajaxterm), it comes up like in the pics (Actual).
I have pinpointed to the code where this happens. the code is:
Python Syntax (Toggle Plain Text)
t=(self.proc[fd]['term']) str= os.read(fd,65536) t.write(str)
As far as i understood, 't' makes an instance of the current terminal, 'str' contains the reply that the python script takes from the unix os to pass it to the web terminal. till now, 'str' would still give me the wrong line drawing character (checked by printing str on the console)
but, I changed the code for 'str' to the following
Python Syntax (Toggle Plain Text)
str= unicode(os.read(fd,65536), "UTF-8")
and could see that 'str' prints the proper unicode line drawing characters as expected on the console.
the line 3 in the original code makes the 'str' to write to the webterminal. but, when i print 't'
on the console, it does still have the incorrect line drawing characters ('t' finally gets printed on the web console).
What am i doing wrong? I assume that 'str' automatically gets changed to the encoding that 't' is using when 't.write(str)' is encountered. I tried doing a
Python Syntax (Toggle Plain Text)
reload(sys) sys.setdefaultencoding('UTF-8')
I am not sure what I am doing wrong. maybe i am not understanding what exactly
the lines
t=(self.proc[fd]['term']) and t.write(str) does or how i could manipulate it to make it work as expected. I tried to seach on this on the web, but didnt get much of help.
Sorry for the long description, but I'd really appreciate if anyone could help me on this.
Thank you.
![]() |
Similar Threads
- Starting Python (Python)
- Delphi Unicode/RTF Question (Pascal and Delphi)
- "The Page Cannot Be Displayed"<ads, and other stuff (Web Browsers)
- unicode and pythonw.exe (Python)
- Python 2.4: AttributeError: 'module' object has no attribute 'argv' (Python)
- Inserting Unicode Characters into a List (Python)
- Python and Unicode (Python)
- system("PAUSE") (C++)
Other Threads in the Python Forum
- Previous Thread: Python GUI to configure Cisco device
- Next Thread: Need help getting text to display in a graphics window
| Thread Tools | Search this Thread |
alarm app beginner cipher cmd coordinates cx-freeze data decimals development dictionary directory dynamic error examples feet file float format function generator getvalue gui halp homework http images import input ip itunes java keycontrol leftmouse line linux list lists loop maintain maze millimeter module mouse mysqldb number numbers output parsing path port prime programming projects push py2exe pygame pyglet pymailer pyqt python queue random recursion schedule screensaverloopinactive script scrolledtext slicenotation split sqlite ssh string strings sudokusolver table terminal text thread threading time tlapse tuple tutorial ubuntu unicode url urllib urllib2 variable variables ventrilo verify vigenere web webservice wikipedia wx.wizard wxpython xlwt





