Skip to content

Instantly share code, notes, and snippets.

@intarstudents
Last active December 18, 2015 15:59
Show Gist options
  • Save intarstudents/5808688 to your computer and use it in GitHub Desktop.
Save intarstudents/5808688 to your computer and use it in GitHub Desktop.
UTF-8 to ASCII

UTF-8 to ASCII

Dependencies

http://userguide.icu-project.org/transforms/general

$ sudo aptitude install libicu-dev

PHP

First you need to enable suport for it.

Example

<?php

$string = "glāžšķūņu rūķīši";
echo transliterator_transliterate(
  "Any-Latin; NFD; [:Nonspacing Mark:] Remove; NFC; [:Punctuation:] Remove; Lower();", 
  $string
);
// Output: glazskunu rukisi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment