twistor/character-encoder

There is no license information available for the latest version (dev-master) of this package.

Installs: 8 074

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/twistor/character-encoder

dev-master 2014-12-12 00:45 UTC

This package is auto-updated.

Last update: 2025-09-26 11:10:18 UTC


README

Build Status

PHP library for detecting and converting character encodings.

The currently supported conversion methods are:

  • mbstring
  • iconv
  • recode

Quick usage:

<?php

use CharacterEncoder\EncoderFactory;

$sample = 'The quick brown fox jumps over the lazy dog';

$encodings = array('utf-8', 'EUC-JP', 'ISO-8859-1');
$encoder = EncoderFactory::create($encodings);

// Convert text to utf-8. Returns false if the encoding could not be detected.
$utf8 = $encoder->toUtf8($sample);

// Advanced usage.

// Returns false if the encoding could not be detected.
$detected = $encoder->detect($sample);

$iso = $encoder->convert($sample, $detected, 'ISO-8859-1');