GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Text::CSV::Encoded::Coder::EncodeGuess(3) User Contributed Perl Documentation Text::CSV::Encoded::Coder::EncodeGuess(3)

Text::CSV::Encoded::Coder::EncodeGuess - Text::CSV::Encoded coder class using Encode::Guess

version 0.25

    use Text::CSV::Encoded  coder_class => 'Text::CSV::Encoded::Coder::EncodeGuess';
    use Spreadsheet::ParseExcel;
    
    my $csv = Text::CSV::Encoded->new();
    
    $csv->encoding( ['ucs2', 'ascii'] ); # guessing ucs2 or ascii?
    $csv->encoding_to_combine('shiftjis');
    
    my $excel = Spreadsheet::ParseExcel::Workbook->Parse( $file );
    my $sheet = $excel->{Worksheet}->[0];
    
    for my $row ( $sheet->{MinRow} .. $sheet->{MaxRow} ) {
        my @fields;
        
        for my $col ( $sheet->{MinCol} ..  $sheet->{MaxCol} ) {
            my $cell = $sheet->{Cells}[$row][$col];
            push @fields, $cell->{Val};
        }
        
        $csv->combine( @fields ) or die;
        print $csv->string, "\n";
    }

This module is inherited from Text::CSV::Encoded::Coder::Encode.

Except for 2 attributes, same as Text::CSV::Encoded::Coder::Encode.

    $csv = $csv->encoding_in( $encoding_list_ref );

The accessor to an encoding for pre-parsing CSV strings. If no encoding is given, returns current $encoding, otherwise the object itself.

    $encoding_list_ref = $csv->encoding_in()

When you pass a list reference, it might guess the encoding from the given list.

    $csv->encoding_in( ['shiftjis', 'euc-jp', 'iso-20022-jp'] );

If it cannot guess the encoding, the first encoding of the list is used.

    $csv = $csv->encoding( $encoding_list_ref );
    $encoding_list_ref = $csv->encoding();

You can pass a list reference to this attribute only:

  * For list data consumed by combine().
  * For list reference returned by getline().

In other word, in "combine" and "print", it might guess an encoding for the passing list data. If it cannot guess the encoding, the first encoding of the list is used.

Encode, Encode::Guess

Makamaka Hannyaharamitu, <makamaka[at]cpan.org>

Copyright 2008-2013 by Makamaka Hannyaharamitu

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

2016-01-28 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.