NAME

UTF8BOM - handling Byte Order Mark for UTF-8 files

SYNOPSIS

use UTF8BOM;

UTF8BOM->insert_into_files(
    recursive => 1,
    dir       => '/path/to/dir',
);

# or on your shell
utf8bom -insert -dir  /path/to/dir  -recursive
utf8bom -strip  -file /path/to/file

# display usage
utf8bom -help

DESCRIPTION

This modules allows you to insert UTF8's BOM into strings and files, or remove it from them easily.

METHODS

check_bom

check whether passed string includes BOM or not, and return boolean.

if( UTF8BOM->check_bom($str) ) {
    # $str includes BOM
} else {
    # $str doesn't include BOM
}
insert_into_str

insert BOM into passed string, and return it.

$str = UTF8BOM->insert_into_str($str)

# Now, $str includes BOM
insert_into_file

insert BOM into head of file.

UTF8BOM->insert_into_file('/path/to/file');

# Now, the file has BOM on it's head.
insert_into_files

insert BOM into head of files.

UTF8BOM->insert_into_files(
    dir       => '/path/to/dir',
    recursive => 1,
);

# Now, all the in the directory has BOM on it's head.
remove_from_str

remove BOM from passed string, and return it.

$str = UTF8DOM->remove_from_str($str);
remove_from_file
UTF8BOM->remove_from_file('/path/to/file');
remove_from_files
UTF8BOM->remove_from_files(
    dir       => '/path/to/dir',
    recursive => 1,
);

SEE ALSO

utf8bom

AUTHOR

Lyo Kato <lyo.kato@gmail.com>

COPYRIGHT AND LICENSE

This library is free software. You can redistribute it and/or modify it under the same terms as perl itself.