| Reply | « Previous Thread | Next Thread » |
|
Hello
I'm developing a text editor which I intend to use to make HTML and other ASCII files. The files must be ASCII for the HTML to work. The problem is that when I try to save a file with a line break it just gives me an error and it saves an empty file. I have tried .encode("utf-8") but its no use to me because it saves into Unicode and I need ASCII. My code: Code:
... # create the file file = open(filename,'w') # write text into it file.write(appuifw.app.body.get()) # close the file file.close() ... |
|
in this way it knows to you in unicode....
import codecs ... # create the file file = codecs.open(filename,'w', 'utf_8') # write text into it file.write(appuifw.app.body.get()) # close the file file.close() ... |
|
Now it saves the file but when I type:
<html> <body bgcolor="#0000ff" text="#ff0000"> Hello </body> </html> It gets saved as: <html>â©<body bgcolor="#0000ff" text="ff0000">â©Helloâ©</body>â©</html> The html doesnt work properly because its not ASCII. I dont understand why it doesnt get saved in ASCII. Any ideas?
Last edited by RICH? : 2006-03-04 at 14:33.
|
|
Quote:
Look previous post with Listbox and editor on phones in the forum ! |
|
Isn't there any kind of quick way to get a simple thing like line breaks working?
It should work automatically. |
|
See this discussion for help: http://discussion.forum.nokia.com/fo...ad.php?t=75517
|
| simo.salminen |
| View Public Profile |
| Find all posts by simo.salminen |
|
But the HTML files still don't work.
It should work just like Windows Notepad and save as ASCII not utf-8. I dont understand it. ![]()
Last edited by RICH? : 2006-03-07 at 14:54.
|
|
Use unicode_string.encode("ascii"). Also, please read this before asking further questions: http://www.joelonsoftware.com/articles/Unicode.html.
|
| simo.salminen |
| View Public Profile |
| Find all posts by simo.salminen |
|
Yeah Ive read that now.
I got some information on the subject and Ive found out that the character you get when you press "0" isnt a ordinary line break. I need a script which checks the input for the ...well... unordinary line break and changes it to the normal one. Nokia E66 PyS60 1.4.4 final |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Problem in compiling Code \Examples\stdlib\guiapp in SDK Ser 60/ Code Warrior | senthilashok | General Symbian C++ | 3 | 2007-01-18 12:27 |
| problem with Code Warrior 5.2 | mayankkedia | General Symbian C++ | 4 | 2006-06-22 09:26 |
| code warrior problems | mayankkedia | Carbide.c++ IDE and plug-ins | 2 | 2004-10-25 07:59 |
| problem with codewarrior 5.2 | mayankkedia | Symbian Tools & SDKs | 3 | 2004-09-27 17:08 |
| CRichText - A simple working few line example | rmuralidharan | General Symbian C++ | 1 | 2003-02-12 08:53 |