Changeset 9121


Ignore:
Timestamp:
2005-02-21T15:45:29+13:00 (19 years ago)
Author:
kjdon
Message:

changed encoding option to input_encoding so it gets the list of encodings from printusage, and auto detect encoding if set to auto.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/bin/script/explode_metadata_database.pl

    r9119 r9121  
    1111use parsargv;
    1212use printusage;
     13my $unicode_list =
     14    [ { 'name' => "auto",
     15    'desc' => "{BasPlug.input_encoding.auto}" },
     16      { 'name' => "ascii",
     17    'desc' => "{BasPlug.input_encoding.ascii}" },
     18      { 'name' => "utf8",
     19    'desc' => "{BasPlug.input_encoding.utf8}" },
     20      { 'name' => "unicode",
     21    'desc' => "{BasPlug.input_encoding.unicode}" } ];
    1322
    1423my $arguments =
    15     [ { 'name' => "encoding",
     24    [ { 'name' => "input_encoding",
    1625    'desc' => "{explode.encoding}",
    17     'type' => "string",
     26    'type' => "enum",
    1827    'deft' => "iso_8859_1",
     28    'list' => $unicode_list,
    1929    'reqd' => "no" } ,
    2030      { 'name' => "metadata_set",
     
    4454    # Parse command line arguments
    4555    if (!parsargv::parse(\@ARGV,
    46              'encoding/.*/iso_8859_1', \$encoding,
     56             'input_encoding/.*/auto', \$encoding,
    4757             'metadata_set/.*/', \$metadata_set,
    4858             'plugin/.*/', \$plugin,
     
    8797    # ...and initialize it
    8898    $plugobj->init(1, "STDERR", "STDERR");
    89 
     99   
     100    if ($encoding eq "auto") {
     101    $plugobj->{'input_encoding'} = $encoding;   
     102    (my $language, $encoding) = $plugobj->textcat_get_language_encoding ($filename);
     103    }
    90104    # Use the plugin's read_file function to avoid duplicating code
    91105    $plugobj->read_file($filename, $encoding, undef, \$text);
Note: See TracChangeset for help on using the changeset viewer.