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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Tim Swann
June 04, 2015
Technology
0
72
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
Tweet
Share
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
ADK + Gemini Enterprise で 外部 API 連携エージェント作るなら OAuth の仕組みを理解しておこう
kaz1437
0
130
AlloyDB 奮闘記
hatappi
0
190
LINEヤフーにおけるAIOpsの現在地
lycorptech_jp
PRO
5
2k
新規事業×QAの挑戦:不確実性を乗りこなす!フェーズごとに求められるQAの役割変革
hacomono
PRO
0
150
詳解 強化学習 / In-depth Guide to Reinforcement Learning
prinlab
0
350
GitHub Copilot CLI で Azure Portal to Bicep
tsubakimoto_s
0
170
AWS CDK「読めるけど書けない」を脱却するファーストステップ
smt7174
3
210
会社紹介資料 / Sansan Company Profile
sansan33
PRO
16
410k
スピンアウト講座05_実践活用事例
overflowinc
0
650
Phase11_戦略的AI経営
overflowinc
0
860
スピンアウト講座03_CLAUDE-MDとSKILL-MD
overflowinc
0
700
バクラク最古参プロダクトで重ねた技術投資を振り返る
ypresto
0
210
Featured
See All Featured
Prompt Engineering for Job Search
mfonobong
0
210
jQuery: Nuts, Bolts and Bling
dougneiner
65
8.4k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
310
Scaling GitHub
holman
464
140k
Believing is Seeing
oripsolob
1
90
A Tale of Four Properties
chriscoyier
163
24k
Deep Space Network (abreviated)
tonyrice
0
94
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
199
73k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
64
52k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
220
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