grep -i και ελληνικά κεφαλαία /πεζά

Panayotis Tsiamis ptsiamis at internet.gr
Wed Dec 14 15:57:26 EET 2005


Gia na mporei na prosthesei sto script tou utf-8 xaraktires


    Writing Python Scripts in Unicode

As you may have noticed from the examples on this page, you can actually 
write Python scripts in UTF-8. Variables must be in ASCII, but you can 
include Chinese comments, or Korean strings in your source files. In 
order for this to work correctly, Python needs to know that your script 
file is not ASCII. You can do this in one of two ways. First, you can 
place a UTF-8 byte-order marker 
<http://evanjones.ca/python-utf8.html#bom> at the beginning of your 
file, if your editor supports it. Secondly, you can place the following 
special comment in the first or second lines of your script:

# -*- coding: utf-8 -*-




Giorgos Keramidas wrote:

>On 2005-12-14 14:49, Panayotis Tsiamis <ptsiamis at internet.gr> wrote:
>  
>
>>    Prosthese mia sto scriptaki sou ayto :
>>
>>    --
>>    #!/usr/bin/python2.3
>>    # -*- coding: utf-8 -*-
>>    ---
>>    
>>
>
>Συγνώμη, αλλά επειδή μου την έσπασε εντελώς που έκανες (α) top-post και
>(β) έστειλες μόνο σε HTML, χείριστα κακοποιημένη από ένα κακορυθμισμένο
>και buggy GUI mailer, σε τι ακριβώς εξυπηρετεί αυτό στο συγκεκριμένο
>script, που δεν έχει κανένα ίχνος από localized χαρακτήρες;
>
>  
>
>>    Giorgos Keramidas wrote:
>>
>> On 2005-12-14 13:37, "Nick Demou (enLogic)" [1]<ndemou at enlogic.gr> wrote:
>>
>>
>> Giorgos Keramidas wrote:
>>
>>
>> [...]
>> Δεν ξέρω τόσο καλά Python, αλλά όλο και κάποια κλήση θα έχει η Python
>> για να θέσει το τρέχον locale...  Α νάτο, το βρήκα.
>>
>>     >>> import os, locale
>>     >>> def mylocale(lname, lcat, lval=None):
>>     ...   locale.setlocale(lcat, lval)
>>     ...   os.putenv(lname, lval)
>>     ...   os.environ[lname] = lval
>>     ...
>>     >>> mylocale("LC_ALL", locale.LC_ALL, "C")
>>     >>> os.environ['LC_ALL']
>>     'C'
>>     >>> mylocale("LC_ALL", locale.LC_ALL, "el_GR.ISO8859-7")
>>     >>> os.environ['LC_ALL']
>>     'el_GR.ISO8859-7'
>>     >>>
>>    
>>
>
>
>  
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hellug.gr/pipermail/linux-greek-users/attachments/20051214/3bf4c8b1/attachment.htm>


More information about the Linux-greek-users mailing list