SlideShare a Scribd company logo
1 of 37
Download to read offline
Encoding
b'xe6x96x87xe5xadx97xe7xb7xa8xe7xa2xbc'
先來回想⼀一下...
先來回想⼀一下...
當學⽣生的時候⼀一定想過要怎麼跟隔壁同學作
弊...
Morse Code
A: ・__
B: __・・・
C: __・__・
D: __・・
Morse Code
A: ・__
B: __・・・
C: __・__・
D: __・・
嗶嗶—
嗶—嗶嗶嗶
嗶—嗶嗶—嗶
嗶—嗶嗶
Morse Code
A: ・__
B: __・・・
C: __・__・
D: __・・
左右
右左左左
右左右左
右左左
Encode / Decode
Encode / Decode
Encode / Decode
Encode
左右
Encode / Decode
Encode
左右 左右
Transport
Encode / Decode
Encode
左右 左右
DecodeTransport
Encode / Decode
50 59 43 4F 4EPYCON
Text Bytes (8 bits)Encode
Writing
Reading
Bytes
50 59 43 4F 4E
Decode Text
PYCON
Encode / Decode in the web
Encode / Decode in the web
HTML Documents
Encode
Bytes
Server
Encode / Decode in the web
HTML Documents
Encode
Bytes
Transport
Server Internet
Encode / Decode in the web
HTML Documents
Encode
Bytes
Transport
Server Internet
Decode
Client
Character Encoding
先回到剛剛的例⼦子,⽤用摩斯電碼作弊
Character Encoding
如果我們把Morse Code ABCD 換成 1234 呢
Character Encoding
A: ・— — — —
B: ・・— — —
C: ・・・— —
D: ・・・・—
左右右右右
左左右右右
左左左右右
左左左左右
Character Encoding
我們把第⼀一種叫做Morse ABCD 第⼆二種叫做
Morse 1234
Character Encoding
如果踢椅⼦子的⼈人⽤用Morse ABCD encode
被踢椅⼦子的⼈人⽤用Morse 1234 decode
Character Encoding
Character Encoding
Character Encoding
Encode
左右
Morse ABCD
Character Encoding
Encode
左右 左右
Transport
Morse ABCD
Character Encoding
Encode
左右 左右
DecodeTransport
Morse ABCD Morse 1234
Character Encoding
Character Encoding
HTML Documents
Encode
Bytes
Server
Big5
Character Encoding
HTML Documents
Encode
Bytes
Transport
Server Internet
Big5
Character Encoding
HTML Documents
Encode
Bytes
Transport
Server Internet
Decode
Client
Big5
UTF-8
Character Encoding
UTF-8: ⽬目前最廣泛的編碼系統 實作Unicode的
⽅方法之⼀一 (Unicode 又稱萬國碼)
ASCII: 早期最廣泛的編碼系統 ⽬目前多被
Unicode取代
Big5: ASCII不⽀支援中⽂文 所以早期台灣中⽂文網
站會⽤用Big5
Character Encoding
⽤用哪種⽅方法encode就要⽤用哪種⽅方法decode!
Character Encoding
這樣才能成功作弊!
Character Encoding
在Chrome裡可以⽤用 檢視 > 字元編碼 來重設網
⾴頁的編碼⽅方式
Character Encoding
http://www.angelfire.com/ok/leekawo/
hacker.htm
讓這個網⾴頁變成可看的中⽂文!
Encoding in Python
在Python中練習 encode / decode 技巧
Encoding in Python
Python 的 string 以 Unicode 為標準
bytes 即為 string encode 的結果!

More Related Content

Viewers also liked

Abnormality - PSYA2
Abnormality - PSYA2Abnormality - PSYA2
Abnormality - PSYA2Nicky Burt
 
Short and long term memory
Short and long term memoryShort and long term memory
Short and long term memorySmiley Rathy
 
Cognitive psychology - Memory (PSYA1)
Cognitive psychology - Memory (PSYA1) Cognitive psychology - Memory (PSYA1)
Cognitive psychology - Memory (PSYA1) Nicky Burt
 
Mod 3 working memory model slides
Mod 3 working memory model slidesMod 3 working memory model slides
Mod 3 working memory model slidesmpape
 
Morse code (-- --- .-. ... . -.-. --- -.. .)
Morse code (-- --- .-. ... . -.-. --- -.. .)Morse code (-- --- .-. ... . -.-. --- -.. .)
Morse code (-- --- .-. ... . -.-. --- -.. .)Tushar Swami
 
Research methods - PSYA1 psychology AS
Research methods - PSYA1 psychology ASResearch methods - PSYA1 psychology AS
Research methods - PSYA1 psychology ASNicky Burt
 
PSYA4 - Research methods
PSYA4 - Research methodsPSYA4 - Research methods
PSYA4 - Research methodsNicky Burt
 
Attachment PSYA1
Attachment PSYA1Attachment PSYA1
Attachment PSYA1Nicky Burt
 
Psychology- Memory
Psychology- MemoryPsychology- Memory
Psychology- MemoryMya007
 

Viewers also liked (14)

Aqa research methods 1
Aqa research methods 1Aqa research methods 1
Aqa research methods 1
 
Phobias
PhobiasPhobias
Phobias
 
Abnormality - PSYA2
Abnormality - PSYA2Abnormality - PSYA2
Abnormality - PSYA2
 
Short and long term memory
Short and long term memoryShort and long term memory
Short and long term memory
 
Cognitive psychology - Memory (PSYA1)
Cognitive psychology - Memory (PSYA1) Cognitive psychology - Memory (PSYA1)
Cognitive psychology - Memory (PSYA1)
 
Mod 3 working memory model slides
Mod 3 working memory model slidesMod 3 working memory model slides
Mod 3 working memory model slides
 
Morse code (-- --- .-. ... . -.-. --- -.. .)
Morse code (-- --- .-. ... . -.-. --- -.. .)Morse code (-- --- .-. ... . -.-. --- -.. .)
Morse code (-- --- .-. ... . -.-. --- -.. .)
 
Morse code
Morse codeMorse code
Morse code
 
Morse code
Morse codeMorse code
Morse code
 
Abnormal psychology
Abnormal psychologyAbnormal psychology
Abnormal psychology
 
Research methods - PSYA1 psychology AS
Research methods - PSYA1 psychology ASResearch methods - PSYA1 psychology AS
Research methods - PSYA1 psychology AS
 
PSYA4 - Research methods
PSYA4 - Research methodsPSYA4 - Research methods
PSYA4 - Research methods
 
Attachment PSYA1
Attachment PSYA1Attachment PSYA1
Attachment PSYA1
 
Psychology- Memory
Psychology- MemoryPsychology- Memory
Psychology- Memory
 

More from Wey-Han Liaw

Python 官方文件中文翻譯專案 - 探討翻譯專案的貢獻流程
Python 官方文件中文翻譯專案 - 探討翻譯專案的貢獻流程Python 官方文件中文翻譯專案 - 探討翻譯專案的貢獻流程
Python 官方文件中文翻譯專案 - 探討翻譯專案的貢獻流程Wey-Han Liaw
 
Educational Code Reviews
Educational Code ReviewsEducational Code Reviews
Educational Code ReviewsWey-Han Liaw
 
Learning: Being as a Homeschooled Student
Learning: Being as a Homeschooled StudentLearning: Being as a Homeschooled Student
Learning: Being as a Homeschooled StudentWey-Han Liaw
 
Jupyter Kernel: How to Speak in Another Language
Jupyter Kernel: How to Speak in Another LanguageJupyter Kernel: How to Speak in Another Language
Jupyter Kernel: How to Speak in Another LanguageWey-Han Liaw
 
Udacity Taipei meetup #2 如何駕馭線上課程
Udacity Taipei meetup #2 如何駕馭線上課程Udacity Taipei meetup #2 如何駕馭線上課程
Udacity Taipei meetup #2 如何駕馭線上課程Wey-Han Liaw
 
Python自學從你小時候開始
Python自學從你小時候開始Python自學從你小時候開始
Python自學從你小時候開始Wey-Han Liaw
 
Meteor Taipei 2016 January talk -- Mantra
Meteor Taipei 2016 January talk -- MantraMeteor Taipei 2016 January talk -- Mantra
Meteor Taipei 2016 January talk -- MantraWey-Han Liaw
 
Understanding Meteor Stack
Understanding Meteor StackUnderstanding Meteor Stack
Understanding Meteor StackWey-Han Liaw
 
SITCON summer camp 2015: Adrian說他那身邊的一堆社群
SITCON summer camp 2015: Adrian說他那身邊的一堆社群SITCON summer camp 2015: Adrian說他那身邊的一堆社群
SITCON summer camp 2015: Adrian說他那身邊的一堆社群Wey-Han Liaw
 
Implementation of Rubik's Cube Formula in PyCuber
Implementation of Rubik's Cube Formula in PyCuberImplementation of Rubik's Cube Formula in PyCuber
Implementation of Rubik's Cube Formula in PyCuberWey-Han Liaw
 
PyCon 2015 Crawler Tutorial Explain Cookies
PyCon 2015 Crawler Tutorial Explain CookiesPyCon 2015 Crawler Tutorial Explain Cookies
PyCon 2015 Crawler Tutorial Explain CookiesWey-Han Liaw
 

More from Wey-Han Liaw (13)

Python 官方文件中文翻譯專案 - 探討翻譯專案的貢獻流程
Python 官方文件中文翻譯專案 - 探討翻譯專案的貢獻流程Python 官方文件中文翻譯專案 - 探討翻譯專案的貢獻流程
Python 官方文件中文翻譯專案 - 探討翻譯專案的貢獻流程
 
Educational Code Reviews
Educational Code ReviewsEducational Code Reviews
Educational Code Reviews
 
Learning: Being as a Homeschooled Student
Learning: Being as a Homeschooled StudentLearning: Being as a Homeschooled Student
Learning: Being as a Homeschooled Student
 
Jupyter Kernel: How to Speak in Another Language
Jupyter Kernel: How to Speak in Another LanguageJupyter Kernel: How to Speak in Another Language
Jupyter Kernel: How to Speak in Another Language
 
Udacity Taipei meetup #2 如何駕馭線上課程
Udacity Taipei meetup #2 如何駕馭線上課程Udacity Taipei meetup #2 如何駕馭線上課程
Udacity Taipei meetup #2 如何駕馭線上課程
 
Python自學從你小時候開始
Python自學從你小時候開始Python自學從你小時候開始
Python自學從你小時候開始
 
Meteor Taipei 2016 January talk -- Mantra
Meteor Taipei 2016 January talk -- MantraMeteor Taipei 2016 January talk -- Mantra
Meteor Taipei 2016 January talk -- Mantra
 
Understanding Meteor Stack
Understanding Meteor StackUnderstanding Meteor Stack
Understanding Meteor Stack
 
Async, await
Async, awaitAsync, await
Async, await
 
SITCON summer camp 2015: Adrian說他那身邊的一堆社群
SITCON summer camp 2015: Adrian說他那身邊的一堆社群SITCON summer camp 2015: Adrian說他那身邊的一堆社群
SITCON summer camp 2015: Adrian說他那身邊的一堆社群
 
NCCU 0617 talk
NCCU 0617 talkNCCU 0617 talk
NCCU 0617 talk
 
Implementation of Rubik's Cube Formula in PyCuber
Implementation of Rubik's Cube Formula in PyCuberImplementation of Rubik's Cube Formula in PyCuber
Implementation of Rubik's Cube Formula in PyCuber
 
PyCon 2015 Crawler Tutorial Explain Cookies
PyCon 2015 Crawler Tutorial Explain CookiesPyCon 2015 Crawler Tutorial Explain Cookies
PyCon 2015 Crawler Tutorial Explain Cookies
 

PyCon 2015 Crawler Tutorial Explain Encoding