PHP Classes

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 (2)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 421 All time: 6,373 This week: 105Up
Version License PHP version Categories
csv_file_to_utf8_enc 1.0.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

Innovation Award
PHP Programming Innovation award nominee
February 2019
Number 10
Some applications need to process text read from CSV files. Nowadays modern applications handle text encoded using UTF-8.

When the a CSV file that an application needs to process has text that is not encoded using UTF-8, it needs to be converted.

This package can perform this task, so applications do not need to perform additional text encoding conversion.

Manuel Lemos
Picture of peyman
  Performance   Level  
Name: peyman <contact>
Classes: 4 packages by
Country: Iran Iran
Age: ???
All time rank: 286550 in Iran Iran
Week rank: 180 Up1 in Iran Iran Up
Innovation award
Innovation award
Nominee: 4x

Example

<?php
require_once("convert_csv_to_utf8.php");

$cv = new convert_csv_to_utf8('csvsimple.csv','csvsimplefixed.csv');


  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 Download Rankings  
 100%
Total:421
This week:0
All time:6,373
This week:105Up
User Comments (1)
Thats a very good and useful class !
4 years ago (José Filipe Lopes Santos)
80%StarStarStarStarStar