Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Converting Legacy Applications To UTF-8
Search
Tim Swann
June 04, 2015
Technology
74
0
Share
Converting Legacy Applications To UTF-8
What are all the angles to be considered when you decide to standardise your text to UTF-8
Tim Swann
June 04, 2015
More Decks by Tim Swann
See All by Tim Swann
PHP Collection Classes | PHPBelfast
faffyman
0
770
Graph data with Neo4J PHP & Neoxygen
faffyman
0
2k
Other Decks in Technology
See All in Technology
Proxmox超入門
devops_vtj
0
120
Oracle AI Database@Azure:サービス概要のご紹介
oracle4engineer
PRO
6
1.4k
NgRx SignalStore: The Power of Extensibility
rainerhahnekamp
0
150
第26回FA設備技術勉強会 - Claude/Claude_codeでデータ分析 -
happysamurai294
0
400
Kubernetes基盤における開発者体験 とセキュリティの両⽴ / Balancing developer experience and security in a Kubernetes-based environment
chmikata
0
220
今年60歳のおっさんCBになる
kentapapa
1
330
Hello UUID
mimifuwacc
0
130
「決め方」の渡し方 / How to hand over the "decision-making process"
pauli
8
1.3k
組織的なAI活用を阻む 最大のハードルは コンテキストデザインだった
ixbox
1
1.2k
TanStack Start エコシステムの現在地 / TanStack Start Ecosystem 2026
iktakahiro
1
360
Oracle AI Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
4
2.2k
AIペネトレーションテスト・ セキュリティ検証「AgenticSec」ご紹介資料
laysakura
0
1.6k
Featured
See All Featured
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
61
43k
Automating Front-end Workflow
addyosmani
1370
200k
Code Reviewing Like a Champion
maltzj
528
40k
Writing Fast Ruby
sferik
630
63k
Typedesign – Prime Four
hannesfritz
42
3k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
2.7k
Git: the NoSQL Database
bkeepers
PRO
432
67k
Technical Leadership for Architectural Decision Making
baasie
3
310
Scaling GitHub
holman
464
140k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
250
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8k
The Cult of Friendly URLs
andyhume
79
6.8k
Transcript
CHARACTER FLAWS CHANGING A LEGACY APPLICATION TO UTF-8 June 4th
2015
• Legacy Applications are a mish-mash of encodings • Ever
dealt with Irish names? • French / German / Eastern European? • What about a €uro Symbol? THE PROBLEM
Standardise your character encoding THE SOLUTION Simple - Right?
<?php header('Content-Type: text/html; charset=UTF-8') ; ?> <meta http-equiv="Content-Type"
content="text/html; charset=UTF-8" /> <meta charset="UTF-8" /> HEADERS All Done… …Just Like Austria in 1982 - Pack up and go home
Set Character Encodings Everywhere CHARACTER IN ≠ CHARACTER OUT Front
End Pages ✔ Database ✔ Tables ✔ Columns ✔ Forms ✔ Server(s) ✔
DATABASE SET NAMES utf8 ; Connections Need to be UTF-8
Aware
DATABASE ALTER DATABASE database_name DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci
Create a UTF-8 Database
DATABASE Change Existing Tables to UTF-8 ALTER TABLE table_name DEFAULT
CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
DATABASE ALTER TABLE table_name CHANGE title title VARCHAR( 128 )
CHARACTER SET utf8 COLLATE utf8_unicode_ci ; Columns Need to be UTF-8
FORMS <form action=“post.php" method="post" enctype="multipart/form-data" accept-charset="UTF-8" > POST only
UTF-8 data
PHP INI default_charset = "utf-8"
PHP TEXT CONVERSION <?php utf8_encode ( $string) ; PHP Functions
Only Encodes ISO-8859-1 Strings
PHP TEXT CONVERSION <?php iconv('ISO-8859-1', 'UTF-8//TRANSLIT', $string); // Translit
= find a similar char e.. ä => a mb_convert_encoding($string, 'UTF-8', ‘ISO-8859-1') // requires php-mbstring extension for multi-bytue support PHP Functions
PHP TEXT CONVERSION <?php htmlentities ( $string, ENT_QUOTES, 'UTF-8') ;
PHP Functions Specify encoding when escaping output
PHP TEXT CONVERSION <?php new UConverter([ string $destination_encoding [, string
$source_encoding ]] ) $unconvertor->convert( $string ) ; Since PHP 5.5 - UConvertor
PHP SOURCE FILES - YOUR IDE All Team members should
have same settings