Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Rubens Takiguti Ribeiro  >  Unicode Manipulation  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Examples of how to print a text file using unicode encoding
Class: Unicode Manipulation
Manipulate text with Unicode encodings
Author: By
Last change:
Date: 5 years ago
Size: 979 bytes
 

Contents

Class file image Download
<?php
/**
 * List of charset code to be used on Content-Type HTTP header (case insensitive):
 * UTF-32be = UTF-32 Big Endian
 * UTF-32le = UTF-32 Little Endian
 * UTF-16be = UTF-16 Big Endian
 * UTF-16le = UTF-16 Little Endian
 * UTF-8    = UTF-8
 */

// Examples of how to print a text file using unicode encoding

require_once(dirname(__FILE__).'/unicode.class.php');

// UTF-32 Big Endian
header('Content-type: text/plain; charset=UTF-32be');
echo 
unicode::chr_utf32(28381true);
exit(
0);

/*

// UTF-32 Little Endian
header('Content-type: text/plain; charset=UTF-32le');
echo unicode::chr_utf32(28381, false);
exit(0);

// UTF-16 Big Endian
header('Content-type: text/plain; charset=UTF-16be');
echo unicode::chr_utf16(28381, true);
exit(0);

// UTF-16 Little Endian
header('Content-type: text/plain; charset=UTF-16le');
echo unicode::chr_utf16(28381, false);
exit(0);

// UTF-8
header('Content-type: text/plain; charset=UTF-8');
echo unicode::chr_utf8(28381);
exit(0);

*/