Chapterبەش 4 · Lectureوانە 4.3

ASCII and Character CodesASCII و کۆدەکانی نووسە

How a computer stores text as bit patterns: how many bits a code needs, packing characters into words, the 7-bit ASCII code and its groups, a corrected ASCII chart, encoding and decoding exercises, the parity bit and error-correcting codes, older codes (Baudot, 6-bit BCD, EBCDIC) and Unicode with UTF-8 today.

چۆن دەق وەک کۆمەڵە هەڵدەگرێت: کۆدێک پێویستی بە چەند هەیە، خستنی چەند لە یەک ، کۆدی حەوت بیتیی و گرووپەکانی، خشتەیەکی ڕاستکراوەی ، ڕاهێنانی کۆدکردن و خوێندنەوەی کۆد، و کۆدە ڕاستکەرەوەکانی هەڵە، کۆدە کۆنەکان (Baudot، BCDـی شەش بیتی و ) و لەگەڵ ⁦UTF-8⁩ ئەمڕۆ.

22 min read23 خولەک خوێندنەوە · 21 stepsهەنگاو

What you will learnچی فێر دەبیت

  • Explain why N bits give 2N2^N different characters and how characters are packed into words.
  • Name the groups of the 128 ASCII codes and find any character in the ASCII chart.
  • Encode text as ASCII codes (decimal, hex and binary) and decode ASCII bit patterns back into text.
  • Add an even or odd parity bit and say what it can and cannot detect.
  • Explain how Unicode and UTF-8 extend ASCII to every writing system, Kurdish included.
  • ڕوونی بکەیتەوە بۆچی N 2N2^N جیاواز دەدات و چۆن لە کۆ دەکرێنەوە.
  • گرووپەکانی ⁦128⁩ کۆدەکەی بناسیت و هەر لە خشتەی بدۆزیتەوە.
  • دەق بکەیت بە کۆدی (، و ) و کۆمەڵە بیتی بخوێنیتەوە و بیکەیتەوە بە دەق.
  • جووت یان تاک زیاد بکەیت و بڵێیت چی دەدۆزێتەوە و چی نادۆزێتەوە.
  • ڕوونی بکەیتەوە و ⁦UTF-8⁩ چۆن بۆ هەموو جۆرە نووسینێک فراوان دەکەن، کوردیشی لەگەڵدا.

Text is stored as bit patternsدەق وەک کۆمەڵە بیت هەڵدەگیرێت

Computers do not only store numbers. A program's code, the names in a shop's customer list, an algebraic expression such as x2+3xx^2 + 3x in a maths program, a text message and a study that counts the words in a book are all text. To store text, the computer gives every — a letter, a digit, a punctuation mark, even a space — its own pattern of bits.

تەنها ژمارە هەڵناگرن. کۆدی ، ناوی کڕیارانی دووکانێک، وەک x2+3xx^2 + 3x لە بیرکاریدا، نامەیەک لە مۆبایلدا و لێکۆڵینەوەیەک کە وشەکانی کتێبێک دەژمێرێت هەموویان دەقن. بۆ هەڵگرتنی دەق، بە هەر — پیتێک، ، نیشانەیەکی خاڵبەندی، تەنانەت — کۆمەڵە بیتێکی تایبەتی خۆی دەدات.

How many bits does each character need? That depends on how many different characters the code must hold. With N bits there are 2N2^N different patterns (see how many patterns N bits give), so each extra bit doubles the number of characters.

هەر پێویستی بە چەند هەیە؟ ئەمە بەندە بەوەی کۆدەکە دەبێت چەند جیاواز هەڵبگرێت. بە N ، 2N2^N کۆمەڵەی جیاواز هەیە (بڕوانە N بیت چەند کۆمەڵە دەدات)، بۆیە هەر بیتێکی زیادە ژمارەی دوو هێندە دەکات.

How many characters N bits can nameN ناوی چەند دەنێت
BitsPatternsکۆمەڵەکانEnough forبەس دەکات بۆ
626=642^6 = 64Capital letters, digits and a few signs — no small lettersپیتە گەورەکان، و چەند نیشانەیەک — بێ پیتە بچووکەکان
727=1282^7 = 128Capital and small letters, digits, signs and control codes (ASCII)پیتە گەورە و بچووکەکان، ، نیشانەکان و کۆدەکانی کۆنترۆڵ ()
828=2562^8 = 256Everything in ASCII plus 128 more charactersهەموو لەگەڵ ⁦128⁩ زیاتر
Numbered lockers at schoolدۆڵابە ژمارەدارەکانی قوتابخانە

A school gives each pupil a locker with a number. Two-digit numbers are enough for 100 pupils; a bigger school needs three digits. A character code works the same way: the more characters you want, the more bits each code needs.

قوتابخانەیەک دۆڵابێکی ژمارەدار دەدات بە هەر قوتابییەک. ژمارەی دوو بۆ ⁦100⁩ قوتابی بەسە؛ قوتابخانەیەکی گەورەتر پێویستی بە سێ هەیە. کۆدی بەهەمان شێوە کار دەکات: تا زیاترت بوێت، هەر کۆدێک پێویستی بە زیاتر دەبێت.

Where the analogy stops workingسنووری ئەم نموونەیە

Locker numbers are decimal, so one more digit gives ten times as many numbers. Codes are binary, so one more bit only doubles them.

ژمارەی دۆڵابەکان ، بۆیە یەک زیاتر دە هێندە ژمارە دەدات. کۆدەکان ، بۆیە یەک زیاتر تەنها دوو هێندەیان دەکات.

Quick checkپشکنینی خێراHow many different characters can a 7-bit code represent?کۆدێکی حەوت بیتی دەتوانێت چەند جیاواز پیشان بدات؟

Text is stored as bit patternsدەق وەک کۆمەڵە بیت هەڵدەگیرێت

Packing characters into wordsخستنی نووسەکان لە وشەکاندا

A computer moves data in Words: fixed groups of bits that it handles in one step, for example 32 or 64 bits. If a word is much longer than a character, keeping only one character in each word wastes most of the word. So several characters are packed into one word: a 32-bit word holds four 8-bit characters.

بە وشەکان دەگوازێتەوە: کۆمەڵە بیتێکی جێگیر کە بە یەک هەنگاو کاری لەسەر دەکات، بۆ نموونە ⁦32⁩ یان ⁦64⁩ . ئەگەر زۆر لە درێژتر بێت، دانانی تەنها یەک لە هەر زۆربەی ئەو بە فیڕۆ دەدات. بۆیە چەند پێکەوە دەخرێنە یەک : ⁦32⁩ بیتی چوار هەشت بیتی هەڵدەگرێت.

Top: a 32-bit word split into four bytes holding the characters K, u, r and d, with their codes 75, 117, 114 and 100 and their 8-bit patterns. Bottom: an older 36-bit word split into six 6-bit characters.سەرەوە: وشەیەکی 32 بیتی کە کراوە بە چوار بایت و نووسەکان K، u، r و d هەڵدەگرێت، لەگەڵ کۆدەکانیان 75، 117، 114 و 100 و کۆمەڵە هەشت بیتییەکانیان. خوارەوە: وشەیەکی 36 بیتیی کۆن کە کراوە بە شەش نووسەی شەش بیتی.
Four 8-bit characters fill a 32-bit word exactly; an old 36-bit word held six 6-bit characters.چوار هەشت بیتی بە تەواوی ⁦32⁩ بیتی پڕ دەکەنەوە؛ ⁦36⁩ بیتیی کۆن شەش شەش بیتیی هەڵدەگرت.CêIT

Why did computers settle on 8 bits? A modern computer needs capital letters, small letters, ten digits and many signs — far more than 64, so 6 bits are too few. Seven bits are enough (128), but 7 is an awkward size for a machine built around powers of two. So the 8-bit became the standard home for one character.

بۆچی هەشت هەڵبژارد؟ نوێ پێویستی بە پیتە گەورەکان، پیتە بچووکەکان، دە و زۆر نیشانە هەیە — زۆر لە ⁦64⁩ زیاتر، بۆیە شەش کەمە. حەوت بەسە ⁦(128)⁩، بەڵام 7 قەبارەیەکی نالەبارە بۆ ئامێرێک کە لەسەر توانەکانی 2 دروست کراوە. بۆیە هەشت بیتی بوو بە شوێنی ستانداردی یەک .

ExerciseڕاهێنانCharacters in a 36-bit wordنووسەکان لە وشەیەکی ⁦36⁩ بیتیدا

An old computer uses 6-bit characters and a word length of 36 bits. How many characters can be packed into one word?

کۆن شەش بیتی بەکار دەهێنێت و درێژیی ⁦36⁩ . چەند دەخرێنە یەک ؟

Show answerوەڵامەکە پیشان بدە
36 bits6 bits per character=6 characters\frac{36 \text{ bits}}{6 \text{ bits per character}} = 6 \text{ characters}

Six characters fit exactly, with no bits left over.

شەش بە تەواوی جێیان دەبێتەوە و هیچ بیتێک نامێنێتەوە.

Quick checkپشکنینی خێراA computer has 64-bit words and stores each character in 8 bits. How many characters fit in one word? ⁦64⁩ بیتیی هەیە و هەر لە هەشت هەڵدەگرێت. چەند لە یەک جێی دەبێتەوە؟

ASCII: one code for every machineASCII: یەک کۆد بۆ هەموو ئامێرێک

Definitionپێناسە

An old standard code that gives every English letter, digit and common symbol a number from 0 to 127, written with 7 . A computer usually keeps each ASCII in one . Today's UTF-8 keeps the same codes and adds every other alphabet, including Kurdish.

کۆدێکی ستانداردی کۆنە کە ژمارەیەک لە 0 تا ⁦127⁩ دەدات بە هەر پیتێکی ئینگلیزی، هەر ژمارەیەک و هەر هێمایەکی باو. ئەم ژمارانە بە ٧ دەنووسرێن و بە زۆری هەر ASCII لە یەک هەڵدەگرێت. ئەمڕۆ ⁦UTF-8⁩ هەمان کۆدەکان دەپارێزێت و هەموو ئەلفوبێکانی تریش زیاد دەکات، لەوانە کوردی.

ASCII stands for American Standard Code for Information Interchange. It was first published in 1963 and revised in 1967 and 1986. Its job is agreement: if every computer, terminal and printer uses the same number for the same character, text can travel between them without turning into nonsense. It was accepted almost everywhere, and most computers and electronic devices still understand it.

کورتکراوەی ⁦American Standard Code for Information Interchange⁩ـە (کۆدی ستانداردی ئەمریکی بۆ ئاڵوگۆڕی زانیاری). یەکەمجار لە ⁦1963⁩ بڵاوکرایەوە و لە ⁦1967⁩ و ⁦1986⁩ نوێ کرایەوە. ئەرکەکەی ڕێککەوتنە: ئەگەر هەموو ، تێرمیناڵ و هەمان ژمارە بۆ هەمان بەکار بهێنن، دەق بەبێ تێکچوون لە نێوانیاندا دەگوازرێتەوە. نزیکەی لە هەموو شوێنێک وەرگیرا و زۆربەی و ئامێرە ئەلیکترۆنییەکان هێشتا تێیدەگەن.

Quick checkپشکنینی خێراWhat problem did ASCII solve? چ کێشەیەکی چارەسەر کرد؟

ASCII: one code for every machineASCII: یەک کۆد بۆ هەموو ئامێرێک

Seven bits, kept in a byteحەوت بیت، لە بایتێکدا

Original ASCII uses 7 bits for each character, so it has 128 codes, numbered 0 to 127. A computer keeps each ASCII character in one 8-bit : the 7 code bits plus one extra bit on the left. For plain ASCII text that extra bit is 0, so the byte for A (code 65) is 01000001.

سەرەتایی بۆ هەر حەوت بەکار دەهێنێت، بۆیە ⁦128⁩ کۆدی هەیە، لە 0 تا ⁦127⁩. هەر لە یەک هەشت بیتیدا هەڵدەگرێت: حەوت بیتەکەی کۆد لەگەڵ یەک بیتی زیادە لە لای چەپ. بۆ دەقی ئاسایی ئەو بیتە زیادەیە 0ـە، بۆیە A (کۆدی ⁦65⁩) دەبێتە 01000001.

Quick checkپشکنینی خێراHow many bits does original ASCII use for one character? سەرەتایی بۆ یەک چەند بەکار دەهێنێت؟

ASCII: one code for every machineASCII: یەک کۆد بۆ هەموو ئامێرێک

The groups inside ASCIIگرووپەکانی ناو ASCII

The 128 codes are not mixed up at random. They come in neat groups, and knowing the groups makes the chart easy to use.

⁦128⁩ کۆدەکە بە هەڕەمەکی تێکەڵ نین. لە گرووپی ڕێکدان. ناسینی گرووپەکان بەکارهێنانی خشتەکە ئاسان دەکات.

The groups of the 128 ASCII codesگرووپەکانی ⁦128⁩ کۆدەکەی
Codes (decimal)کۆدەکان ()GroupگرووپWhat they areچین
0–31, 127Control characters (33) ⁦(33)⁩Not printable. They tell a device to do something: start a new line, move to the next tab stop, beep.چاپ ناکرێن. بە ئامێرێک دەڵێن کارێک بکات: دێڕێکی نوێ دەست پێ بکات، بچێتە خاڵی تابی دواتر، دەنگ بدات.
32Space (1) ⁦(1)⁩The gap between words. It prints no mark but takes a place, so it counts as a printable character.بۆشایی نێوان وشەکان. هیچ نیشانەیەک چاپ ناکات بەڵام شوێنێک دەگرێت، بۆیە بە چاپکراو دادەنرێت.
33–47, 58–64, 91–96, 123–126Symbols (32) ⁦(32)⁩Printable, but neither letters nor digits: punctuation, maths and technical signs.چاپ دەکرێن، بەڵام نە پیتن نە : نیشانەکانی خاڵبەندی، بیرکاری و تەکنیکی.
48–57Digits (10) ⁦(10)⁩The ten digits 0 to 9.دە 0 تا 9.
65–90Capital letters (26)پیتە گەورەکان ⁦(26)⁩A to Z.A تا Z.
97–122Small letters (26)پیتە بچووکەکان ⁦(26)⁩a to z.a تا z.

Check the total: 33+95=12833 + 95 = 128 — 33 control codes and 95 printable characters (the space, 32 symbols, 10 digits and 52 letters).

کۆکەی بپشکنە: 33+95=12833 + 95 = 128 — ⁦33⁩ کۆدی کۆنترۆڵ و ⁦95⁩ چاپکراو (، ⁦32⁩ ، ⁦10⁩ و ⁦52⁩ پیت).

Quick checkپشکنینی خێراWhich ASCII code is the space character?کام کۆدی ؟

The ASCII chart, correctedخشتەی ASCII، ڕاستکراوە

The chart below shows all 128 codes as 8 rows of 16. The row is the first digit (the left 3 bits of the code) and the column is the second hex digit (the right 4 bits). So the hex code is simply “row digit, then column digit”, and the decimal code is 16×row+column16 \times \text{row} + \text{column}. The small number in each cell is the decimal code.

خشتەکەی خوارەوە هەموو ⁦128⁩ کۆدەکە وەک 8 ڕیز پیشان دەدات، هەر ڕیزێک ⁦16⁩ کۆد. ڕیز یەکەم (سێ چەپی کۆدەکە) و ستوون دووەمی (چوار ڕاست). کەواتە کۆدی تەنها « ڕیز، پاشان ستوون»ـە و کۆدی 16×row+column16 \times \text{row} + \text{column}ـە. ژمارە بچووکەکەی ناو هەر خانەیەک کۆدە .

The full ASCII chart: 8 rows (0 to 7) and 16 columns (0 to F). Rows 0 and 1 and the last cell (127, DEL) are grey control codes such as NUL, BEL, BS, HT, LF, CR and ESC. Row 2 starts with SP (space, 32) followed by symbols. Row 3 holds the digits 0 to 9 (48 to 57). Rows 4 and 5 hold @, the capital letters A to Z (65 to 90) and [ ] ^ _. Rows 6 and 7 hold the backtick, the small letters a to z (97 to 122) and { | } ~.خشتەی تەواوی ASCII: 8 ڕیز (0 تا 7) و 16 ستوون (0 تا F). ڕیزەکانی 0 و 1 و خانەی کۆتایی (127، DEL) نووسەکانی کۆنترۆڵ خۆڵەمێشین وەک NUL، BEL، BS، HT، LF، CR و ESC. ڕیزی 2 بە SP (بۆشایی، 32) دەست پێ دەکات و پاشان هێماکان دێن. ڕیزی 3 تاکژمارەکانی 0 تا 9 هەڵدەگرێت (48 تا 57). ڕیزەکانی 4 و 5 @، پیتە گەورەکانی A تا Z (65 تا 90) و [ ] ^ _ هەڵدەگرن. ڕیزەکانی 6 و 7 باکتیک، پیتە بچووکەکانی a تا z (97 تا 122) و { | } ~ هەڵدەگرن.
All 128 ASCII codes, generated from the standard and checked by a program. Colours show the groups.هەموو ⁦128⁩ کۆدەکەی ، لە ستانداردەکەوە دروستکراوە و بە پشکنراوە. ڕەنگەکان گرووپەکان پیشان دەدەن.CêIT

The handout draws the same 128 codes as 16 rows of 8 (bits 3–6 pick the row, bits 0–2 the column). The layout is different, but the codes are the same. In both charts a single character in a cell is printable, while a two- or three-letter name such as SP, BS or CR is a space or a control code.

بڵاوکراوەکە هەمان ⁦128⁩ کۆد وەک ⁦16⁩ ڕیز پیشان دەدات، هەر ڕیزێک هەشت کۆد ( ⁦3–6⁩ ڕیزەکە هەڵدەبژێرن و ⁦0–2⁩ ستوونەکە). شێوەکە جیاوازە، بەڵام کۆدەکان هەمانن. لە هەردوو خشتەکەدا تاک لە خانەیەکدا چاپ دەکرێت، بەڵام ناوێکی دوو یان سێ پیتی وەک SP، BS یان CR یان کۆدێکی کۆنترۆڵە.

Quick checkپشکنینی خێراUse the chart. What is the hex code of the small letter a?خشتەکە بەکار بهێنە. کۆدی بۆ پیتی بچووکی a چییە؟

The ASCII chart, correctedخشتەی ASCII، ڕاستکراوە

The course's tables, correctedخشتەکانی کۆرسەکە، ڕاستکراوە

Quick checkپشکنینی خێراThe midterm's printed table gives & the code 37. Which character really has code 37?خشتە چاپکراوەکەی تاقیکردنەوەی نیوەی وەرز کۆدی ⁦37⁩ بە & دەدات. لە ڕاستیدا کۆدی ⁦37⁩ هی کام ؟

The ASCII chart, correctedخشتەی ASCII، ڕاستکراوە

Control charactersنووسەکانی کۆنترۆڵ

Definitionپێناسە

A character code that does not print a symbol but tells a device to do something, such as start a new line. In ASCII the codes 0–31 and 127 are control characters.

کۆدی کە هیچ هێمایەک چاپ ناکات، بەڵکو بە ئامێرێک دەڵێت کارێک بکات، وەک دەستپێکردنی دێڕێکی نوێ. لە ASCIIـدا کۆدەکانی 0 تا ⁦31⁩ و ⁦127⁩ نووسەی کۆنترۆڵن.

Most control codes come from the teleprinter (Teletype), a typewriter-like machine that printed on paper and sent text down a wire. CR (carriage return) sent the print head back to the start of the line, and LF (line feed) moved the paper up one line. That is why a new line in a text file is still a control code: Windows ends lines with CR LF, while Linux and macOS use LF alone.

زۆربەی کۆدەکانی کۆنترۆڵ لە تێلێپرینتەر ⁦(Teletype)⁩ـەوە هاتوون، ئامێرێکی وەک تایپ کە لەسەر کاغەز چاپی دەکرد و دەقی بە وایەردا دەنارد. ⁦CR (carriage return)⁩ سەری چاپەکەی دەگەڕاندەوە بۆ سەرەتای دێڕ و ⁦LF (line feed)⁩ کاغەزەکەی یەک دێڕ بەرز دەکردەوە. بۆیە دێڕی نوێ لە دەقیدا هێشتا کۆدێکی کۆنترۆڵە: Windows دێڕەکان بە ⁦CR LF⁩ کۆتایی پێ دەهێنێت، بەڵام Linux و macOS تەنها LF بەکار دەهێنن.

The control codes you will meet mostئەو کۆدانەی کۆنترۆڵ کە زۆرتر دەیانبینیت
CodeکۆدNameناوWhat it doesچی دەکات
0NULNull: “nothing”, used as filler.هیچ: بۆ پڕکردنەوە بەکار دێت.
7BELBell: asks for attention (a beep).زەنگ: داوای سەرنج دەکات (دەنگێک).
8BSBackspace: move back one place.گەڕانەوە: یەک شوێن بگەڕێوە دواوە.
9HTHorizontal tab: jump to the next tab stop (the Tab key).تابی ئاسۆیی: بازدان بۆ خاڵی تابی دواتر ( Tab).
10LFLine feed: go to the next line (old name NL).⁦Line feed⁩: بچۆ بۆ دێڕی دواتر (ناوی کۆن NL).
12FFForm feed: start a new page (old name NP).⁦Form feed⁩: لاپەڕەیەکی نوێ دەست پێ بکە (ناوی کۆن NP).
13CRCarriage return: go back to the start of the line.⁦Carriage return⁩: بگەڕێوە بۆ سەرەتای دێڕەکە.
27ESCEscape: the next few characters have a special meaning.Escape: چەند دواتر واتایەکی تایبەتیان هەیە.
127DELDelete: on paper tape, punching all 7 holes erased a wrong character.سڕینەوە: لەسەر شریتی کاغەز، کونکردنی هەر حەوت کونەکە هەڵەی دەسڕییەوە.
Quick checkپشکنینی خێراWhich control code moves to the next line?کام کۆدی کۆنترۆڵ دەچێتە دێڕی دواتر؟

Clever patterns in the chartڕێکخستنی زیرەکانەی خشتەکە

ASCII was designed so that useful facts are hidden in the bits. Digits: 0 is 48 = 0110000 and 7 is 55 = 0110111. The right four bits of a digit's code are the digit's own value in binary, so subtracting 48 from the code gives the digit (55−48=755 - 48 = 7). These four bits are exactly the digit's BCD code.

بەجۆرێک دیزاین کراوە کە زانیاریی بەسوود لە ناو شاراوەیە. : 0 ⁦48⁩ـە = 0110000 و 7 ⁦55⁩ـە = 0110111. چوار ڕاستی کۆدی هەر نرخی خودی ئەو بە ، بۆیە ئەگەر ⁦48⁩ لە کۆدەکە کەم بکەیتەوە دەمێنێتەوە (55−48=755 - 48 = 7). ئەم چوار ڕێک کۆدی دەیی دووانیی ئەو .

Letters: A is 65 and a is 97. The difference is 32, which is a single bit: A = 1000001, a = 1100001. Every capital letter and its small letter differ only in that one bit, so changing case means flipping one bit.

پیتەکان: A ⁦65⁩ـە و a ⁦97⁩ـە. جیاوازییەکەیان ⁦32⁩ـە، کە تەنها یەک : A = 1000001، a = 1100001. هەموو پیتێکی گەورە و پیتە بچووکەکەی تەنها لەو یەک جیاوازن، بۆیە گۆڕینی گەورەیی و بچووکیی پیت واتە گۆڕینی یەک .

Neighbours in the chartدراوسێکانی ناو خشتەکە
CharacterDecimalBinary (7 bits) (⁦7⁩ )
048011 0000
755011 0111
957011 1001
A65100 0001
a97110 0001
Z90101 1010
z122111 1010

Programs compare text by these codes. Because every capital letter (65–90) comes before every small letter (97–122), sorting by code puts “Zebra” before “apple”.

دەق بەپێی ئەم کۆدانە بەراورد دەکەن. چونکە هەموو پیتێکی گەورە ⁦(65–90)⁩ پێش هەموو پیتێکی بچووک ⁦(97–122)⁩ دێت، بەپێی کۆد «Zebra» پێش «apple» دادەنێت.

Quick checkپشکنینی خێراWhat is the decimal ASCII code of the small letter g?لە ، کۆدی بۆ پیتی بچووکی g چییە؟

How To Read Text In BinaryTom Scott · Englishئینگلیزی · 2M viewsبینین · 67K likesلایک

Reading ASCII text in binary by hand: 010 starts capitals, 011 starts small letters, and the last five bits give the alphabet position.

خوێندنەوەی دەقی بە بە دەست: ⁦010⁩ سەرەتای پیتە گەورەکانە، ⁦011⁩ سەرەتای پیتە بچووکەکان و پێنج کۆتایی شوێنی پیتەکە لە ئەلفوبێدا دەدەن.

Whole video (3:29).

هەموو ڤیدیۆکە ⁦(3:29)⁩.

From text to bits and backلە دەقەوە بۆ بیتەکان و بە پێچەوانەوە

Encoding and decoding by handکۆدکردن و خوێندنەوەی کۆد بە دەست
  1. Encode: find each codeکۆدکردن: کۆدی هەر یەکێک بدۆزەوە

    Look up each character (spaces and punctuation too) in the chart and write its decimal or hex code.

    هەر (بۆشایی و نیشانەکانی خاڵبەندیش) لە خشتەکەدا بدۆزەوە و کۆدە یان بنووسە.

  2. Encode: convert to binaryکۆدکردن: بیگۆڕە بۆ دووانی

    Write each code in 7 bits (or 8 bits with a 0 in front for a byte). Hex is quickest: each hex digit becomes 4 bits.

    هەر کۆدێک بە حەوت بنووسە (یان هەشت بە 0ـێک لە پێشەوە بۆ ). خێراترینە: هەر دەبێتە چوار .

  3. Decode: split, convert, look upخوێندنەوە: دابەشی بکە، بیگۆڕە، بیدۆزەوە

    Split the bits into groups of 7 (or 8), turn each group into a decimal number, and find that number in the chart.

    بکە بە گرووپی حەوتی (یان هەشتی)، هەر گرووپێک بگۆڕە بۆ ژمارەیەکی و ئەو ژمارەیە لە خشتەکەدا بدۆزەوە.

The word “hope” in ASCII, one byte per letterوشەی «hope» بە ، بۆ هەر پیتێک یەک
CharacterDecimalHexByte (8 bits) (⁦8⁩ )
h1046801101000
o1116F01101111
p1127001110000
e1016501100101
Quick checkپشکنینی خێراDecode the two 7-bit codes 1001000 1101001.ئەم دوو کۆدە حەوت بیتییە بخوێنەرەوە: 1001000 1101001.

Exercises from the courseڕاهێنانەکانی کۆرسەکە

ExerciseڕاهێنانA. Decode the messagesA. نامەکان بخوێنەرەوە

Decode these ASCII-coded messages: (a) 1001001 1000001 1001101 (b) 1000011 1001111 1000100 (c) 1010011 1100101 1100011 1110100 1101001 1101111 1101110 0100000 0110010 0111011

ئەم نامانەی بە کۆدکراون بخوێنەرەوە: (أ) 1001001 1000001 1001101 (ب) 1000011 1001111 1000100 (ج) 1010011 1100101 1100011 1110100 1101001 1101111 1101110 0100000 0110010 0111011

Hintئاماژە

Turn each 7-bit group into decimal first, then use the chart.

سەرەتا هەر گرووپێکی حەوت بیتی بگۆڕە بۆ ، پاشان خشتەکە بەکار بهێنە.

Show answerوەڵامەکە پیشان بدە
MessageنامەDecimal codesکۆدەکان بە Textدەق
(a)(أ)73 65 77IAM
(b)(ب)67 79 68COD
(c)(ج)83 101 99 116 105 111 110 32 50 59Section 2;

In message (c), code 32 is a space, 50 is the digit 2 (not the number two) and 59 is a semicolon.

لە نامەی (ج)دا کۆدی ⁦32⁩ ، ⁦50⁩ 2ـە (نەک ژمارەی دوو) و ⁦59⁩ .

ExerciseڕاهێنانB. Encode two program linesB. دوو دێڕی بەرنامە کۆد بکە

Write the ASCII codes of these two program statements in hexadecimal and in binary: (a) 80 INPUT Y (b) 30 INPUT A, B They are lines of an old BASIC program: a line number, then a statement that asks the user to type values into the variables. Every space and the comma are characters too.

کۆدەکانی ئەم دوو بە و بە بنووسە: (أ) 80 INPUT Y (ب) 30 INPUT A, B ئەمانە دێڕی کۆنی BASICـن: ژمارەی دێڕ، پاشان کە داوا لە بەکارهێنەر دەکات نرخ بۆ گۆڕاوەکان بنووسێت. هەموو و کۆماکەش (,) .

Show answerوەڵامەکە پیشان بدە
(a) 80 INPUT Y(أ) ⁦80 INPUT Y⁩TEXT
char:  8       0       SP      I       N       P       U       T       SP      Y
hex:   38      30      20      49      4E      50      55      54      20      59
bin:   0111000 0110000 0100000 1001001 1001110 1010000 1010101 1010100 0100000 1011001
(b) 30 INPUT A, B(ب) ⁦30 INPUT A, B⁩TEXT
char:  3       0       SP      I       N       P       U       T       SP      A       ,       SP      B
hex:   33      30      20      49      4E      50      55      54      20      41      2C      20      42
bin:   0110011 0110000 0100000 1001001 1001110 1010000 1010101 1010100 0100000 1000001 0101100 0100000 1000010

Hex to binary is quick: each hex digit is 4 bits, for example 4E is 0100 1110, which as 7 bits is 1001110. Notice that the digits 8, 0 and 3 are characters 38, 30 and 33 hex, not the numbers 8, 0 and 3.

گۆڕینی بۆ خێرایە: هەر چوار ، بۆ نموونە ⁦4E⁩ دەبێتە 0100 1110 و بە حەوت دەبێتە 1001110. سەرنج بدە کە 8، 0 و 3 ⁦38⁩، ⁦30⁩ و ⁦33⁩ی ، نەک ژمارەکانی 8، 0 و 3.

ExerciseڕاهێنانMidterm question: what is the message?پرسیاری تاقیکردنەوەی نیوەی وەرز: نامەکە چییە؟

The following message is encoded in ASCII. What is the message? 1000111 1001111 1010100 1001111 0100000 1001110 0110100 0110111

ئەم نامەیەی خوارەوە بە کۆد کراوە. نامەکە چییە؟ 1000111 1001111 1010100 1001111 0100000 1001110 0110100 0110111

Show answerوەڵامەکە پیشان بدە
BitsDecimalCharacter
100011171G
100111179O
101010084T
100111179O
010000032space
100111078N
0110100524
0110111557

The message is GOTO N47. None of these codes needed the two wrong entries of the exam's printed table, but check any table before you trust it.

نامەکە ⁦GOTO N47⁩ـە. هیچ کام لەم کۆدانە پێویستی بە دوو هەڵەکەی خشتە چاپکراوەکەی تاقیکردنەوەکە نەبوو، بەڵام پێش متمانەکردن بە هەر خشتەیەک بیپشکنە.

ExerciseڕاهێنانYour turn: encode a nameنۆرەی تۆیە: ناوێک کۆد بکە

Write the name Lana as four hex codes.

ناوی Lana وەک چوار کۆدی بنووسە.

Hintئاماژە

Capital L is row 4; small letters are in rows 6 and 7.

Lـی گەورە لە ڕیزی 4ـدایە؛ پیتە بچووکەکان لە ڕیزەکانی 6 و 7ـدان.

Show answerوەڵامەکە پیشان بدە

L = 4C, a = 61, n = 6E, a = 61, so the name is 4C 61 6E 61 (decimal 76 97 110 97).

L = ⁦4C⁩، a = ⁦61⁩، n = ⁦6E⁩، a = ⁦61⁩، کەواتە ناوەکە دەبێتە ⁦4C 61 6E 61⁩ (: ⁦76 97 110 97⁩).

The parity bit: a simple checkبیتی پاریتی: پشکنینێکی سادە

When a byte travels along a wire, electrical noise can flip a bit from 0 to 1 or from 1 to 0. A cheap way to notice this is a : the sender adds one extra bit so that the number of 1s in the byte is always even (even parity) or always odd (odd parity). The receiver counts the 1s. If the count is wrong, a bit has changed on the way.

کاتێک بە وایەرێکدا دەڕوات، ژاوەژاو دەتوانێت لە 0ـەوە بکات بە 1 یان لە 1ـەوە بکات بە 0. ڕێگایەکی هەرزان بۆ هەستکردن بەمە ـە: نێرەرەکە یەک زیادە دادەنێت بۆ ئەوەی ژمارەی 1ـەکانی ناو هەمیشە جووت بێت (پاریتیی جووت) یان هەمیشە تاک بێت (پاریتیی تاک). وەرگرەکە 1ـەکان دەژمێرێت. ئەگەر ژمارەکە هەڵە بێت، لە ڕێگادا گۆڕاوە.

Animation. The keys O and K are typed. O is 1001111, which has five 1s, so the even-parity bit is 1 and the byte is 11001111. K is 1001011, which has four 1s, so the parity bit is 0 and the byte is 01001011. Then one bit of K flips on the way, the receiver counts three 1s, an odd number, and knows the byte is wrong. The last frame lists what one parity bit can and cannot do.
Animation. The keys O and K are typed. O is 1001111, which has five 1s, so the even-parity bit is 1 and the byte is 11001111. K is 1001011, which has four 1s, so the parity bit is 0 and the byte is 01001011. Then one bit of K flips on the way, the receiver counts three 1s, an odd number, and knows the byte is wrong. The last frame lists what one parity bit can and cannot do.
Even parity on the letters O and K, and a flipped bit caught by the receiver.پاریتیی جووت لەسەر پیتەکانی O و K. وەرگرەکە گۆڕاو دەگرێت.CêIT
Adding a parity bit (the parity bit is the leftmost bit)زیادکردنی ( چەپترین )
Character7-bit codeکۆدی حەوت بیتیNumber of 1sژمارەی 1ـەکانEven parity byte بە پاریتیی جووتOdd parity byte بە پاریتیی تاک
O100111151100111101001111
K100101140100101111001011
Quick checkپشکنینی خێراThe 7-bit code 1010001 is sent with even parity. What is the parity bit?کۆدی حەوت بیتیی 1010001 بە پاریتیی جووت دەنێردرێت. چییە؟

Error detection: Parity checkingBen Eater · Englishئینگلیزی · 392K viewsبینین · 11K likesلایک · Partبەشی 0:00–7:37 (ofلە 21:41)

How one parity bit catches a bit flipped on a wire, and how XOR gates compute parity, using ASCII text such as "hello world".

یەک چۆن دەدۆزێتەوە کە لەسەر وایەرێک پێچەوانە بووەتەوە، هەروەها چۆن هەژمار دەکەن، بە نموونەی دەقی وەک «⁦hello world⁩».

Plays 0:00-7:37: transmission errors, redundancy, the parity idea and the XOR parity circuit; the rest builds and tests hardware.

لە ⁦0:00⁩ تا ⁦7:37⁩ پەخش دەبێت: هەڵەکانی گواستنەوە، زیادە بۆ پشکنین، بیرۆکەی و بە XOR؛ باقی ڤیدیۆکە ڕاستەقینە دروست دەکات و تاقی دەکاتەوە.

The parity bit: a simple checkبیتی پاریتی: پشکنینێکی سادە

What one parity bit can and cannot doیەک بیتی پاریتی چی دەتوانێت و چی ناتوانێت

One parity bit catches any single flipped bit (in fact any odd number of flips). Two flipped bits cancel each other out and pass unseen, and the receiver cannot tell which bit is wrong, so the byte must be sent again. Old serial links commonly sent 7 data bits plus a parity bit; today networks and disks use stronger checks, such as CRC codes, that catch far more errors.

یەک هەر یەک گۆڕاو دەگرێت (لە ڕاستیدا هەر ژمارەیەکی تاکی گۆڕان). دوو گۆڕاو یەکتر پووچ دەکەنەوە و نابینرێن. هەروەها وەرگرەکە ناتوانێت بزانێت کام هەڵەیە، بۆیە دەبێت دووبارە بنێردرێتەوە. هێڵە زنجیرەییە کۆنەکان زۆرجار حەوت لەگەڵ دەنارد؛ ئەمڕۆ و دیسکەکان پشکنینی بەهێزتر وەک کۆدەکانی CRC بەکار دەهێنن کە زۆر هەڵەی زیاتر دەگرن.

Some error codes go further and correct the error. A Hamming code (Richard Hamming, 1950) adds several check bits, each one checking a different group of data bits, so the receiver can work out which bit flipped and flip it back. The ECC memory of servers uses this idea to fix single-bit errors on its own.

هەندێک کۆدی هەڵە زیاتر دەڕۆن و هەڵەکە ڕاست دەکەنەوە. کۆدی Hamming (ڕیچارد هامینگ، ⁦1950⁩) چەند پشکنین زیاد دەکات کە هەر یەکێکیان گرووپێکی جیاوازی دەپشکنێت، بۆیە وەرگرەکە دەتوانێت بزانێت کام گۆڕاوە و بیگەڕێنێتەوە. ECCـی ڕاژەکارەکان ئەم بیرۆکەیە بەکار دەهێنێت بۆ ئەوەی هەڵەی یەک خۆی ڕاست بکاتەوە.

Quick checkپشکنینی خێراA byte is sent with even parity, and on the way two of its bits flip. What does the receiver notice? بە پاریتیی جووت دەنێردرێت و لە ڕێگادا دوو دەگۆڕێن. وەرگرەکە چی هەست پێ دەکات؟

Older codes: Baudot and 6-bit BCDکۆدە کۆنەکان: Baudot و BCDـی شەش بیتی

The oldest code in this story is the Baudot code of the 1870s, made for the telegraph. It used only 5 bits, so it had just 25=322^5 = 32 patterns — too few for letters and digits together. Two special codes, letters and figures, switched the meaning of the codes after them, a little like the Shift key. An improved version (ITA2, 1932) ran the world's teleprinters for decades.

کۆنترین کۆدی ئەم چیرۆکە کۆدی Baudotـە لە ساڵانی ⁦1870⁩دا، کە بۆ تەلەگراف دروست کرا. تەنها پێنج بەکار دەهێنا، بۆیە تەنها 25=322^5 = 32 کۆمەڵەی هەبوو — بۆ پیت و پێکەوە زۆر کەم بوو. دوو کۆدی تایبەت، پیتەکان و ژمارەکان، واتای ئەو کۆدانەیان دەگۆڕی کە دوایان دەهاتن، کەمێک وەک Shift. وەشانێکی باشترکراو (⁦ITA2⁩، ⁦1932⁩) بۆ چەندین دەیە تێلێپرینتەرەکانی جیهانی بەڕێوە دەبرد.

Before ASCII, many computers used a 6-bit BCD character code with 48 characters: the 26 capital letters, the ten digits 0–9 and twelve special characters (+ - * / , . ( ) $ = ' and the space). With small differences it was the standard of many machines and appeared in many computer manuals. Notice what is missing: there are no small letters.

پێش ، زۆر کۆدی شەش بیتیی BCDـی بەکار دەهێنا کە ⁦48⁩ بوو: ⁦26⁩ پیتە گەورەکە، دە ⁦0–9⁩ و دوازدە تایبەت (+ - * / , . ( ) $ = ' و ). بە جیاوازیی کەمەوە ستانداردی زۆر ئامێر بوو و لە زۆر ڕێنمایی دەرکەوت. سەرنج بدە چی نییە: هیچ پیتێکی بچووک نییە.

Quick checkپشکنینی خێراWhy could the 6-bit BCD character code not hold both capital and small letters?بۆچی کۆدی شەش بیتیی BCDـی نەیدەتوانی پیتە گەورە و بچووکەکان پێکەوە هەڵبگرێت؟

Older codes: Baudot and 6-bit BCDکۆدە کۆنەکان: Baudot و BCDـی شەش بیتی

EBCDIC, and the codes in one tableEBCDIC و کۆدەکان لە یەک خشتەدا

EBCDIC (Extended BCD Interchange Code) grew out of that BCD code at IBM in the 1960s. It is an 8-bit code that adds small letters and many more special characters. Some IBM mainframes still use it; almost every other computer uses ASCII and Unicode.

⁦(Extended BCD Interchange Code)⁩ لە IBM لە ساڵانی ⁦1960⁩دا لەو کۆدە BCDـیەوە سەری هەڵدا. کۆدێکی هەشت بیتییە کە پیتە بچووکەکان و زۆر تایبەتی تر زیاد دەکات. هەندێک IBM هێشتا بەکاری دەهێنن؛ نزیکەی هەموو تر و بەکار دەهێنن.

Character codes over timeکۆدەکانی بە درێژایی کات
CodeکۆدBitsPatternsکۆمەڵەکانUsed forبۆ چی
Baudot / ITA2525=322^5 = 32telegraph and teleprinters (1870s–1970s)تەلەگراف و تێلێپرینتەر (⁦1870⁩ تا ⁦1970⁩)
6-bit BCDBCDـی شەش بیتی626=642^6 = 64early computers (1950s–60s), capitals onlyیەکەم (ساڵانی ⁦1950⁩ و ⁦1960⁩)، تەنها پیتی گەورە
ASCII727=1282^7 = 128almost every computer since the 1960sنزیکەی هەموو لە ساڵانی ⁦1960⁩ـەوە
EBCDIC828=2562^8 = 256IBM mainframes IBM
Unicode in UTF-8 بە ⁦UTF-8⁩8 to 32 (1 to 4 bytes)8 تا ⁦32 (1⁩ تا 4 )over 1.1 million code pointsزیاتر لە ⁦1.1⁩ ملیۆن the web and phones today, Kurdish includedوێب و مۆبایل ئەمڕۆ، کوردیشی لەگەڵدا
Quick checkپشکنینی خێراWhich code do almost all web pages and phones use for text today?نزیکەی هەموو و مۆبایلەکان ئەمڕۆ کام کۆد بۆ دەق بەکار دەهێنن؟

Unicode and UTF-8: ASCII todayUnicode و ⁦UTF-8⁩: ASCII لە ئەمڕۆدا

ASCII has English letters only. There is no room for Kurdish letters such as ڕ, ڵ, ۆ and ێ, nor for Arabic, Chinese or emoji. For years each region used its own 8-bit code, and text often turned into nonsense when it moved between computers. fixed this with one list of every character of every writing system. Each character gets a number called a , written as U+ and hex: A is U+0041 and ڕ is U+0695. There is room for over 1.1 million code points (U+0000 to U+10FFFF).

تەنها پیتی ئینگلیزیی تێدایە. شوێنی نییە بۆ پیتە کوردییەکانی وەک ڕ، ڵ، ۆ و ێ، نە بۆ عەرەبی، چینی یان . بۆ چەندین ساڵ هەر ناوچەیەک کۆدێکی هەشت بیتیی تایبەتی خۆی بەکار دەهێنا و دەق زۆرجار کاتێک لە دەچووە تر تێک دەچوو. ئەمەی چارەسەر کرد بە یەک لیست بۆ هەموو هەموو سیستەمێکی نووسین. هەر ژمارەیەک وەردەگرێت کە پێی دەوترێت ، بە ⁦U+⁩ و دەنووسرێت: A ⁦U+0041⁩ـە و ڕ ⁦U+0695⁩ـە. شوێن هەیە بۆ زیاتر لە ⁦1.1⁩ ملیۆن (⁦U+0000⁩ تا ⁦U+10FFFF⁩).

Quick checkپشکنینی خێراBefore Unicode, why did text often turn into nonsense when it moved to another computer?پێش ، بۆچی دەق زۆرجار کاتێک دەچووە تر تێک دەچوو؟

Unicode and UTF-8: ASCII todayUnicode و ⁦UTF-8⁩: ASCII لە ئەمڕۆدا

UTF-8: one to four bytes⁦UTF-8⁩: یەک تا چوار بایت

The first 128 code points of Unicode are exactly ASCII. UTF-8, the used by almost every web page today, stores each code point in 1 to 4 bytes. An ASCII character still takes one byte with the same value, so every ASCII file is already a valid UTF-8 file. Bytes of the longer characters always start with a 1 bit, so they can never be mistaken for ASCII.

یەکەم ⁦128⁩ ڕێک . ⁦UTF-8⁩، ئەو نزیکەی هەموو ئەمڕۆ بەکاری دەهێنن، هەر لە 1 تا 4 هەڵدەگرێت. هێشتا یەک بە هەمان نرخ دەگرێت، بۆیە هەر خۆی دروستی ⁦UTF-8⁩ـە. درێژترەکان هەمیشە بە 1 دەست پێ دەکەن، بۆیە هەرگیز لەگەڵ تێکەڵ نابن.

UTF-8 byte patterns. U+0000 to U+007F: one byte, 0xxxxxxx, example A = 41. U+0080 to U+07FF: two bytes, 110xxxxx 10xxxxxx, example the Kurdish letter ڕ U+0695 = DA 95. U+0800 to U+FFFF: three bytes, 1110xxxx 10xxxxxx 10xxxxxx, example € U+20AC = E2 82 AC. U+10000 to U+10FFFF: four bytes, 11110xxx followed by three 10xxxxxx bytes, example the emoji U+1F600 = F0 9F 98 80.شێوەکانی بایتی UTF-8. U+0000 تا U+007F: یەک بایت، 0xxxxxxx، نموونە A = 41. U+0080 تا U+07FF: دوو بایت، 110xxxxx 10xxxxxx، نموونە پیتی کوردیی ڕ U+0695 = DA 95. U+0800 تا U+FFFF: سێ بایت، 1110xxxx 10xxxxxx 10xxxxxx، نموونە € U+20AC = E2 82 AC. U+10000 تا U+10FFFF: چوار بایت، 11110xxx و پاشان سێ بایتی 10xxxxxx، نموونە ئیمۆجیی U+1F600 = F0 9F 98 80.
UTF-8 keeps ASCII as one byte and uses 2 to 4 bytes for everything else.⁦UTF-8⁩ وەک یەک دەهێڵێتەوە و بۆ هەموو شتێکی تر 2 تا 4 بەکار دەهێنێت.CêIT

So a Kurdish word takes more bytes than an English word of the same length: Kurd is 4 bytes but کورد is 8. The Database Administration course counts bytes of Kurdish names in Kurdish letters in UTF-8.

بۆیە وشەیەکی کوردی زیاتر دەگرێت لە وشەیەکی ئینگلیزیی بە هەمان درێژی: Kurd چوار بەڵام کورد هەشتە. کۆرسی بەڕێوەبردنی ناوە کوردییەکان دەژمێرێت لە پیتە کوردییەکان لە ⁦UTF-8⁩ـدا.

Quick checkپشکنینی خێراHow many bytes does the letter A take in UTF-8?پیتی A لە ⁦UTF-8⁩ـدا چەند دەگرێت؟

Characters, Symbols and the Unicode Miracle - ComputerphileComputerphile · Englishئینگلیزی · 2.1M viewsبینین · 58K likesلایک · Partبەشی 0:00–8:39 (ofلە 9:37)

How Unicode gives every character a number and how UTF-8 stores it in one to four bytes while plain ASCII stays unchanged.

چۆن دەداتە هەموو و ⁦UTF-8⁩ چۆن لە یەک تا چوار هەڵیدەگرێت، بە شێوەیەک کە ئاسایی وەک خۆی دەمێنێتەوە.

Plays 0:00-8:39 and stops before the Audible advert.

لە ⁦0:00⁩ تا ⁦8:39⁩ پەخش دەبێت و پێش ڕیکلامی Audible ڕادەوەستێت.

Unicode and UTF-8: ASCII todayUnicode و ⁦UTF-8⁩: ASCII لە ئەمڕۆدا

Your turn: Kurdish in Unicodeنۆرەی تۆیە: کوردی لە Unicodeـدا

ExerciseڕاهێنانThe word «کورد» in Unicodeوشەی «کورد» لە Unicodeـدا

The word «کورد» has four letters: ک, و, ر and د. (a) Write the Unicode code point of each letter in hex and its UTF-8 bytes. (b) Why should Kurdish web pages be written in Unicode, and not with an old non-Unicode Kurdish font?

وشەی «کورد» چوار پیتی هەیە: ک، و، ر و د. (أ) هەر پیتێک بە و ⁦UTF-8⁩ـی بنووسە. (ب) بۆچی دەبێت کوردی بە بنووسرێن، نەک بە کوردیی کۆنی نا-Unicode؟

Hintئاماژە

All four letters lie between U+0080 and U+07FF, so each takes two bytes: 110xxxxx 10xxxxxx. In Python, ord('ک') gives the code point and 'ک'.encode() the bytes.

هەر چوار پیتەکە لە نێوان ⁦U+0080⁩ و ⁦U+07FF⁩ دان، بۆیە هەر یەکێکیان دوو دەگرێت: ⁦110xxxxx 10xxxxxx⁩. لە Pythonـدا ord('ک') دەدات و 'ک'.encode() .

Show answerوەڵامەکە پیشان بدە
LetterپیتCode pointUTF-8 bytes (hex) ⁦UTF-8⁩ ()
کU+06A9DA A9
وU+0648D9 88
رU+0631D8 B1
دU+062FD8 AF
06A916=110 1010 10012  ⇒  110 11010‾    10 101001‾=DA A9\text{06A9}_{16} = 110\,1010\,1001_2 \;\Rightarrow\; 110\,\underline{11010}\;\;10\,\underline{101001} = \text{DA A9}

How the bytes of ک are made: the 11 bits of the code point are split 5 + 6 and placed after the markers 110 and 10.

ک چۆن دروست دەبن: ⁦11⁩ دەکرێنە 5 و 6 و لە دوای نیشانەکانی ⁦110⁩ و ⁦10⁩ دادەنرێن.

(a) «کورد» is 4 code points and 8 bytes. (b) In Unicode the file stores the real Kurdish letters, so every phone and computer can show them with any Unicode font, search engines find the words, copy and paste keeps them, and screen readers can read them. Old non-Unicode fonts stored the codes of other letters and only drew them as Kurdish: without that exact font the reader sees nonsense, and search, sorting and spell checking see the wrong letters. To type Kurdish in Unicode, add the Central Kurdish (Sorani) keyboard in your system's language settings.

(أ) «کورد» چوار و هەشت . (ب) لە پیتە کوردییە ڕاستەقینەکان هەڵدەگرێت، بۆیە هەموو مۆبایل و دەتوانێت بە هەر پیشانیان بدات، وشەکان دەدۆزنەوە، کۆپی و پەیست دەیانپارێزێت و دەتوانن بیانخوێننەوە. کۆنی نا-Unicode کۆدی پیتی تری هەڵدەگرت و تەنها وەک کوردی دەیکێشان: بەبێ هەمان ، خوێنەر شتێکی بێواتا دەبینێت و گەڕان، و پشکنینی ڕێنووس پیتی هەڵە دەبینن. بۆ نووسینی کوردی بە ، کوردیی ناوەندی (سۆرانی) لە ڕێکخستنەکانی زمانی سیستەمەکەتدا زیاد بکە.

Quick checkپشکنینی خێراA Kurdish web page looks right only on computers that have one special font installed. What is the most likely cause? کوردی تەنها کاتێک دروست دەردەکەوێت کە تایبەت لەسەر دامەزرابێت. هۆکاری ئەگەرداری چییە؟

Common mistakesهەڵە باوەکان

MistakeهەڵەFixچارەسەر
Writing the digit character 7 as 0000111.نووسینی 7 وەک 0000111.The character 7 is code 55 = 0110111. 0000111 is the number seven, which in ASCII is the control code BEL. 7 کۆدی ⁦55⁩ـە = 0110111. 0000111 ژمارەی حەوتە کە لە کۆدی کۆنترۆڵی BELـە.
Mixing hex and decimal codes: “A = 41”.تێکەڵکردنی کۆدی و : «⁦A = 41⁩».Say which base you mean: A is 6510=411665_{10} = 41_{16}.بڵێ مەبەستت کام : A 6510=411665_{10} = 41_{16}ـە.
Dropping the leading 0 when the question asks for 8 bits.فڕێدانی 0ـی پێشەوە کاتێک پرسیارەکە داوای هەشت دەکات.In a byte, H is 01001000, not 1001000.لە ، H 01001000ـە نەک 1001000.
Forgetting spaces and punctuation when encoding.لەبیرکردنی بۆشایی و نیشانەکانی خاڵبەندی لە کاتی کۆدکردندا.Every space is code 32 and every comma is 44; they take a byte like any letter.هەر کۆدی ⁦32⁩ـە و هەر کۆمایەک (,) ⁦44⁩ـە؛ وەک هەر پیتێک دەگرن.
Trusting a printed table that says - = 95 or & = 37.متمانەکردن بە خشتەیەکی چاپکراو کە دەڵێت - = ⁦95⁩ یان & = ⁦37⁩.95 is _, 45 is -, 37 is %, 38 is &.⁦95⁩ _ـە، ⁦45⁩ -ـە، ⁦37⁩ %ـە، ⁦38⁩ &ـە.
Thinking ASCII contains Kurdish letters.وا بیرکردنەوە کە پیتی کوردیی تێدایە.Kurdish letters are in Unicode and take 2 bytes each in UTF-8.پیتە کوردییەکان لە و هەر یەکێکیان لە ⁦UTF-8⁩ـدا دوو دەگرێت.

Summaryپوختە

  • N bits give 2N2^N codes: 6 bits give 26=642^6 = 64, 7 bits 27=1282^7 = 128, 8 bits 28=2562^8 = 256. Several characters are packed into one word.
  • ASCII is a 7-bit code (0–127) stored one character per byte: control codes 0–31 and 127, space 32, digits 48–57, A–Z 65–90, a–z 97–122, symbols in between.
  • Hex code = row digit + column digit of the chart; capital and small letters differ by 32 (one bit).
  • A parity bit makes the number of 1s even or odd; it catches one flipped bit but not two.
  • 6-bit BCD and EBCDIC are older codes. Today text is Unicode, usually stored as UTF-8, which keeps ASCII as single bytes. Baudot (5 bits) came before them all, and error-correcting codes such as Hamming codes fix single bits.
  • N 2N2^N کۆد دەدات: شەش 26=642^6 = 64، حەوت 27=1282^7 = 128 و هەشت 28=2562^8 = 256. چەند پێکەوە دەخرێنە یەک .
  • کۆدێکی حەوت بیتییە ⁦(0–127)⁩ و هەر لە هەڵدەگیرێت: کۆنترۆڵ ⁦0–31⁩ و ⁦127⁩، ⁦32⁩، ⁦48–57⁩، ⁦A–Z 65–90⁩، ⁦a–z 97–122⁩، لە نێوانیاندا.
  • کۆدی = ڕیز + ستوونی خشتەکە؛ پیتی گەورە و بچووک بە ⁦32⁩ جیاوازن (یەک ).
  • ژمارەی 1ـەکان جووت یان تاک دەکات؛ یەک گۆڕاو دەگرێت بەڵام دووان نا.
  • BCDـی شەش بیتی و کۆدی کۆنن. ئەمڕۆ دەق و بە زۆری وەک ⁦UTF-8⁩ هەڵدەگیرێت کە وەک یەک دەهێڵێتەوە. Baudot (پێنج ) پێش هەموویان بوو و کۆدی ڕاستکەرەوەی هەڵەی وەک Hamming ڕاست دەکەنەوە.
Review questionsپرسیارەکانی پێداچوونەوە
What is the ASCII code of the space, in decimal and in hex?کۆدی ASCIIـی بۆشایی چییە، بە دەیی و بە شانزەیی؟

3210=201632_{10} = 20_{16}.

3210=201632_{10} = 20_{16}.

Decode 1000001 1010010 1000001 1001101.1000001 1010010 1000001 1001101 بخوێنەرەوە.

65 82 65 77 = ARAM.

کۆدەکان ⁦65 82 65 77⁩ن = ARAM.

Why can a 32-bit word hold four ASCII characters?بۆچی وشەیەکی ⁦32⁩ بیتی دەتوانێت چوار نووسەی ASCII هەڵبگرێت؟

Each character is kept in an 8-bit byte, and 4×8=324 \times 8 = 32.

هەر لە هەشت بیتیدا هەڵدەگیرێت و 4×8=324 \times 8 = 32.

Is every ASCII file a valid UTF-8 file?ئایا هەر فایلێکی ASCII فایلێکی دروستی ⁦UTF-8⁩ـیشە؟

Yes. UTF-8 stores code points 0–127 as the same single bytes as ASCII.

بەڵێ. ⁦UTF-8⁩ ⁦0–127⁩ وەک هەمان یەک هەڵدەگرێت.

Videoڤیدیۆ

Watch a videoسەیری ڤیدیۆیەک بکە

A video that viewers liked a lot and praised in their comments, chosen for this lesson.ڤیدیۆیەک کە بینەران زۆریان پێ خۆش بووە و لە کۆمێنتەکانیاندا ستایشیان کردووە، بۆ ئەم وانەیە هەڵبژێردراوە.

The Ultimate Guide to ASCII and Unicode for GCSEThe Tech Train · Englishئینگلیزی · 362K viewsبینین · 9.4K likesلایک

What ASCII is, how characters become binary codes, why 7 or 8 bits are not enough for every language, and how Unicode fixes that.

چییە، چۆن دەبنە کۆدی ، بۆچی 7 یان 8 بۆ هەموو زمانێک بەس نییە و چۆن ئەمە چارەسەر دەکات.

0:00 intro; 1:31 ASCII in binary; 2:24 keyboard codes; 2:48 the problem; 3:17 Unicode; 3:54 recap; 4:49 test yourself.

⁦0:00⁩ پێشەکی؛ ⁦1:31⁩ بە ؛ ⁦2:24⁩ کۆدەکانی ؛ ⁦2:48⁩ گرفتەکە؛ ⁦3:17⁩ ؛ ⁦3:54⁩ پێداچوونەوە؛ ⁦4:49⁩ خۆت تاقی بکەرەوە.

Lesson complete!وانەکە تەواو بوو!

Well done. Review the key terms, then go on to the next lesson.دەستخۆش. سەیرێکی زاراوە سەرەکییەکان بکەرەوە، پاشان بڕۆ بۆ وانەی داهاتوو.

Key termsزاراوە سەرەکییەکان

Next lessonوانەی داهاتوو

Electricity Basics: Voltage, Current and Resistanceبنەماکانی کارەبا: ڤۆڵتیە، تەزوو و بەرگری

References and further readingسەرچاوەکان و خوێندنەوەی زیاتر

This lecture is a first edition. The Kurdish text and terminology are waiting for review by Kurdish IT teachers.ئەم وانەیە چاپی یەکەمە. دەقە کوردییەکە و زاراوەکانی چاوەڕێی پێداچوونەوەی مامۆستایانی کوردی بواری IT ن.