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

Modified Files:
        misc.py 
Log Message:
handle html code as unicode

Index: misc.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/util/misc.py,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** misc.py     5 Feb 2004 19:26:42 -0000       1.23
--- misc.py     7 Feb 2004 11:54:29 -0000       1.24
***************
*** 11,14 ****
--- 11,17 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.24  2004/02/07 11:54:29  dischi
+ # handle html code as unicode
+ #
  # Revision 1.23  2004/02/05 19:26:42  dischi
  # fix unicode handling
***************
*** 373,376 ****
--- 376,383 ----
  
  def htmlenties2txt(string):
+     """
+     Converts a string to a string with all html entities resolved.
+     Returns the result as Unicode object (that may conatin chars outside 256.
+     """
      e = copy.deepcopy(htmlentitydefs.entitydefs)
      e['ndash'] = "-";
***************
*** 380,385 ****
      e['hellip'] = '...'
  
!     string = string.encode(config.LOCALE, 'ignore').replace("&#039", "'").\
!              replace("’", "'")
  
      i = 0
--- 387,391 ----
      e['hellip'] = '...'
  
!     string = Unicode(string).replace("&#039", "'").replace("’", "'")
  
      i = 0
***************
*** 393,397 ****
          if string[amp + 1] == "#": # numerical entity like "'"
              entity = string[amp:semicolon+1]
!             replacement = str(chr(int(entity[2:-1])))
          else:
              entity = string[amp:semicolon + 1]
--- 399,403 ----
          if string[amp + 1] == "#": # numerical entity like "'"
              entity = string[amp:semicolon+1]
!             replacement = Unicode(unichr(int(entity[2:-1])))
          else:
              entity = string[amp:semicolon + 1]
***************
*** 404,408 ****
                  continue
          string = string.replace(entity, replacement)
-     #string = string.encode(config.LOCALE, 'ignore')
      return string
  
--- 410,413 ----



-------------------------------------------------------
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