PHP Classes
elePHPant
Icontem

PHP Convert CSV to UTF-8: Convert a CSV file to have data in UTF-8 encoding

Recommend this page to a friend!
  Info   View files Example   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2019-02-03 (Yesterday) RSS 2.0 feedNot yet rated by the usersTotal: Not yet counted Not yet ranked
Version License PHP version Categories
csv_file_to_utf8_enc 1.0The PHP License5PHP 5, Files and Folders, Text proces...
Description Author

This class can convert a CSV file to have data in UTF-8 encoding.

It takes the name of a file with data in CSV format, detects the encoding of the text data that it contains and converts it to UTF-8 in case the data is not already in this encoding.

The resulting data can be stored in the same file or another file with a given name.

Recommendations

Detect file encoding and convert it to UTF-8 without BOM
I am unable to detect file encoding, that needs to be converted

  Performance   Level  
Name: peyman <contact>
Classes: 3 packages by
Country: Iran Iran
Innovation award
Innovation award
Nominee: 2x

Details

csv_file_to_utf8_encoding

convert CSV file encoding to utf-8

usage

$cv = new convert_csv_to_utf8($file_address,$saveto=false);
  • file_address : csv file address
  • saveto (optional) : save fixed csv file to location . if not set fixed csv file will be replaced with original csv ### return : return converted/true if successfully convert/fixed csv file , return filenotfind/false if file is not exist

convert_encoding

$string = convert_csv_to_utf8::convert_to_utf8($string, $encoding);
  • string : your text
  • encoding : your text encoding ### return : return encoded text to utf-8
  Files folder image Files  
File Role Description
Plain text file convert_csv_to_utf8.php Class Class source
Accessible without login Plain text file csvsimple.csv Data Auxiliary data
Accessible without login Plain text file demo.php Example Example script
Accessible without login Plain text file README.md Doc. Documentation

 Version Control Unique User Downloads  
 100%
Total:0
This week:0