Update of /cvsroot/freevo/freevo/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6975/src

Modified Files:
        config.py item.py osd.py 
Log Message:
Handle filenames internally as unicode objects.

This does *NOT* affect filenames that have only ASCII chars, since the translation 
ASCII -> Unicode is painless. However this *DOES* affect files with accents, like é 
(e acute, \xe9) and others.

I tested with Video, Images and Music modules, but *NOT* with Games, so if you have 
the games modules, give it a try.

It determines the encoding based on (in order) FREEVO_LOCALE, LANG and LC_ALL, which 
may have the form: "LANGUAGE_CODE.ENCODING", like "pt_BR.UTF-8", and others.



Index: config.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/config.py,v
retrieving revision 1.92
retrieving revision 1.93
diff -C2 -d -r1.92 -r1.93
*** config.py   17 Jan 2004 20:30:18 -0000      1.92
--- config.py   5 Feb 2004 02:52:20 -0000       1.93
***************
*** 23,26 ****
--- 23,35 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.93  2004/02/05 02:52:20  gsbarbieri
+ # Handle filenames internally as unicode objects.
+ #
+ # This does *NOT* affect filenames that have only ASCII chars, since the translation 
ASCII -> Unicode is painless. However this *DOES* affect files with accents, like é 
(e acute, \xe9) and others.
+ #
+ # I tested with Video, Images and Music modules, but *NOT* with Games, so if you 
have the games modules, give it a try.
+ #
+ # It determines the encoding based on (in order) FREEVO_LOCALE, LANG and LC_ALL, 
which may have the form: "LANGUAGE_CODE.ENCODING", like "pt_BR.UTF-8", and others.
+ #
  # Revision 1.92  2004/01/17 20:30:18  dischi
  # use new metainfo
***************
*** 843,844 ****
--- 852,871 ----
      os.environ['LD_PRELOAD'] = ''
      
+ encoding = None
+ try:
+     encoding = os.environ[ 'FREEVO_LOCALE' ].split( '.' )[ 1 ]
+ except:
+     try:
+         encoding = os.environ[ 'LANG' ].split( '.' )[ 1 ]
+     except:
+         try:
+             encoding = os.environ[ 'LC_ALL' ].split( '.' )[ 1 ]
+         except:
+             encoding = sys.getdefaultencoding()
+             print "WARNING:" + \
+                    "Could not determine system encoding! Did look in FREEVO_LOCALE, 
LANG and LC_ALL environment variables for 'language.encoding' pair, but nothing found! 
Using %s" % encoding
+ 
+ if not encoding:
+     encoding = sys.getdefaultencoding()
+ 
+ _debug_( "Using '%s' encoding" % encoding )

Index: item.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/item.py,v
retrieving revision 1.60
retrieving revision 1.61
diff -C2 -d -r1.60 -r1.61
*** item.py     3 Feb 2004 20:46:57 -0000       1.60
--- item.py     5 Feb 2004 02:52:20 -0000       1.61
***************
*** 10,13 ****
--- 10,22 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.61  2004/02/05 02:52:20  gsbarbieri
+ # Handle filenames internally as unicode objects.
+ #
+ # This does *NOT* affect filenames that have only ASCII chars, since the translation 
ASCII -> Unicode is painless. However this *DOES* affect files with accents, like é 
(e acute, \xe9) and others.
+ #
+ # I tested with Video, Images and Music modules, but *NOT* with Games, so if you 
have the games modules, give it a try.
+ #
+ # It determines the encoding based on (in order) FREEVO_LOCALE, LANG and LC_ALL, 
which may have the form: "LANGUAGE_CODE.ENCODING", like "pt_BR.UTF-8", and others.
+ #
  # Revision 1.60  2004/02/03 20:46:57  dischi
  # fix debug warning
***************
*** 492,495 ****
              return self.__getitem__(attr)
          else:
!             return str(self.__getitem__(attr))
              
--- 501,507 ----
              return self.__getitem__(attr)
          else:
!             try:
!                 return str(self.__getitem__(attr))
!             except UnicodeEncodeError:
!                 return self.__getitem__( attr ).encode( config.encoding )
              

Index: osd.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/osd.py,v
retrieving revision 1.131
retrieving revision 1.132
diff -C2 -d -r1.131 -r1.132
*** osd.py      4 Feb 2004 17:32:35 -0000       1.131
--- osd.py      5 Feb 2004 02:52:25 -0000       1.132
***************
*** 11,14 ****
--- 11,23 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.132  2004/02/05 02:52:25  gsbarbieri
+ # Handle filenames internally as unicode objects.
+ #
+ # This does *NOT* affect filenames that have only ASCII chars, since the translation 
ASCII -> Unicode is painless. However this *DOES* affect files with accents, like é 
(e acute, \xe9) and others.
+ #
+ # I tested with Video, Images and Music modules, but *NOT* with Games, so if you 
have the games modules, give it a try.
+ #
+ # It determines the encoding based on (in order) FREEVO_LOCALE, LANG and LC_ALL, 
which may have the form: "LANGUAGE_CODE.ENCODING", like "pt_BR.UTF-8", and others.
+ #
  # Revision 1.131  2004/02/04 17:32:35  dischi
  # fix crash for deactivated osd and fix busy icon redraw
***************
*** 1252,1255 ****
--- 1261,1267 ----
              return None
  
+         if type( url ) == unicode:
+             url = url.encode( config.encoding )
+ 
          thumbnail = False
          filename  = url



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to