Text/Unicode handling functions and File wrapper class
CheckBom | Try to look for a bom byte at the beginning of the given line |
CheckMagicComment | Try to decode the given text on the basis of a magic |
DecodeString | Decode the given string to Unicode using the provided |
EncodeString | Try and encode a given unicode object to a string |
FallbackReader | Guess the encoding of a file by brute force by trying one |
GetEncodings | Get a list of possible encodings to try from the locale information |
GuessEncoding | Attempt to guess an encoding |
EdFile | Wrapper for representing a file object that stores data |
FileLoadEvent | Event to signal that a chunk of text haes been read |
FileReadJob | Job for running an async file read in a background thread |
ReadError | Error happened while trying to read the file |
WriteError | Error happened while trying to write the file |
Try to look for a bom byte at the beginning of the given line
Parameters: | line – line (first line) of a file |
---|---|
Returns: | encoding or None |
Try to decode the given text on the basis of a magic comment if one is present.
Parameters: | lines – list of lines to check for a magic comment |
---|---|
Returns: | encoding or None |
Decode the given string to Unicode using the provided encoding or the DEFAULT_ENCODING if None is provided.
Parameters: |
|
---|
Try and encode a given unicode object to a string with the provided encoding returning that string. The default encoding will be used if None is given for the encoding.
Parameters: |
|
---|
Guess the encoding of a file by brute force by trying one encoding after the next until something succeeds.
Parameters: | fname – file path to read from |
---|
Todo
deprecate this method
Get a list of possible encodings to try from the locale information
Returns: | list of strings |
---|
Attempt to guess an encoding
Parameters: |
|
---|---|
Returns: | encoding or None |