LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-23-2003, 02:25 PM   #1
maseby
Member
 
Registered: Oct 2003
Posts: 42

Rep: Reputation: 15
Question python2 programming


Need help!!!!!!!!!!



I trying to run a .py file in python2 interpreter...but the thing is that this file contains the swedish letters ,,

so the output is missing these letters...instead there is some other funny characters.....

I know that I am susposed to have the latin6 package on with the nordic iso-8859-10 encoding system....


but the thing is...that I dont know how to
 
Old 10-24-2003, 04:07 PM   #2
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 64
I dunno how it is in python (it has been a long time since I last worked with it) but in C/C++ you need to get the handle of scape sequences to perform Swedish (or whatever other characters outside the ASCII table) to do not get weird characters. Here is some examples:

#include <iostream>
using namespace std;

int main()
{
unsigned char tecken;
tecken = '\x84'; // Det hr r hex till tecknet , decimal-kod r 132


// tecken = '\x86'; // Det hr r hex till tecknet , decimal-kod r 134
// tecken = '\x94'; // Det hr r hex till teckent , decimal-kod r 148

cout << tecken << "\n\n";

return 0;
}

I mean that if you want to write :

"Mitt namn r Megaman X", it should be:

"Mitt namn \x84r Megaman X". So it's sure to work at the console without a problem. Check to see if python supports either hex or scape sequences(I really cannot remember, been coding with it and pygame but I don't remember needing it). A complete list of characters is found here:

http://www.asciitable.com/

Lycka till!
 
Old 10-24-2003, 04:17 PM   #3
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 64
More details to find the hex code. After finding the character in questions from the ASCII table, let's say "", it has code decimal 132 right? Open a calculator with advanced options (as hex and oct.) type 132, then choose hex. You will see that the hex code of the number 132 is 84, that's how I came up with '\x84' sequence.

Vi ses
 
Old 10-26-2003, 04:47 AM   #4
maseby
Member
 
Registered: Oct 2003
Posts: 42

Original Poster
Rep: Reputation: 15
tnx.......

great....


thats a way to solve it.....but I am sure there is another way that some how implements the nordic encoding system....


one way or another I will find out....
 
Old 10-26-2003, 06:13 PM   #5
maseby
Member
 
Registered: Oct 2003
Posts: 42

Original Poster
Rep: Reputation: 15
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Python2.4 sanu Linux - Newbie 1 04-01-2005 08:31 AM
Install python2.4 elopee Programming 7 02-01-2005 01:14 PM
python2.2 is not available? darrylneufeld Fedora 4 06-01-2004 09:10 AM
python2 interpreter..... maseby Programming 0 10-23-2003 05:34 PM
python2.2 Dependencies webboss Linux - General 3 03-06-2002 05:20 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration