Changeset 694

Show
Ignore:
Timestamp:
06/18/08 15:52:42 (2 months ago)
Author:
sylvain
Message:

improved the BOM util function

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • oss/headstock/headstock/lib/utils.py

    r677 r694  
    1414 
    1515def remove_BOM(text): 
    16     if text[0] == codecs.BOM_UTF8.decode("utf-8")
     16    if codecs.BOM_UTF8.decode("utf-8") in text
    1717        return text.replace(codecs.BOM_UTF8.decode("utf-8"), '') 
    18     if text[0] == codecs.BOM.decode("utf-16")
     18    if codecs.BOM.decode("utf-16") in text
    1919        return text.replace(codecs.BOM.decode("utf-16"), '') 
    20     if text[0] == codecs.BOM_BE.decode("utf-16-be")
     20    if codecs.BOM_BE.decode("utf-16-be") in text
    2121        return text.replace(codecs.BOM_BE.decode("utf-16-be"), '') 
    22     if text[0] == codecs.BOM_LE.decode("utf-16-le")
     22    if codecs.BOM_LE.decode("utf-16-le") in text
    2323        return text.replace(codecs.BOM_LE.decode("utf-16-le"), '') 
    2424