ASCII and ANSI character code

ASCII દરેક character ને એક number આપે છે (A=65, a=97, 0=48), જેથી text એવા machine માં રહી શકે જે ખાલી numbers જ store કરે છે; ANSI આ set ને 256 સુધી લંબાવીને regional characters પણ સમાવે છે.

9 min read · 9 cards · 2 checks

Read in: English · हिन्दी · ગુજરાતી


Theory

A અક્ષરની મુસાફરી

તમે દુકાનના counter પર બેઠાં બેઠાં WhatsApp message માં A type કરો છો અને send દબાવો છો.

પણ wires, chips અને radio waves તો ખાલી એ જ 1 અને 0 લઈ જાય છે જે તમે ભણ્યા છો, ના કોઈ અક્ષર, ના કોઈ આકાર. તમારી keypress અને તમારા friend ની screen ની વચ્ચે ક્યાંક A ને number બનવું પડે, bits બનીને મુસાફરી કરવી પડે, અને પાછું A બની જવું પડે.

આ બધું શક્ય કરે એવી dictionary એટલે ASCII, અને એની 3-4 key entries exam માં guaranteed marks અપાવે એવી છે.

Theory

એક જાહેર roll-call list

કલ્પના કરો કે દુનિયાના દરેક character એક લાઈનમાં ઊભા છે, દરેકના હાથમાં એક roll number: A પાસે 65, B પાસે 66, digit character 5 પાસે 53, અને પેલો દેખાય નહીં એવો space પણ 32 લઈને ઊભો છે. દુનિયાના દરેક computer પાસે એ જ SAME list છે, એટલે Surat થી મોકલેલો number 65 São Paulo માં પણ ચોક્કસ A જ ગણાય. Encoding એટલે બીજું કંઈ નહીં, આ share કરેલી roll-call જ.

Theory

ASCII, formal રીતે

ASCII (American Standard Code for Information Interchange) એ એક 7-bit code છે: 2⁷ = 128 characters, જેમાં English letters, digits, punctuation અને control characters (Enter અને Backspace જેવી ના દેખાય એવી actions) આવી જાય.

ANSI એ એને 8 bits = 256 characters સુધી લંબાવ્યું, અને વધારાના 128 slots regional letters અને symbols માટે વાપર્યા (é, ñ, જુદા જુદા code pages માં ₹ જેવા symbols).

Codes તો ખાલી numbers છે, એટલે એ તમે ભણ્યા એ binary રૂપે જ store અને travel થાય છે: A = 65 = 1000001.

At a glance

યાદ રાખવા જેવા codes

CharacterCodeકઈ રીતે યાદ રાખવું
A થી Z65 થી 90A = 65, આ જ anchor
a થી z97 થી 122capital + 32
0 થી 948 થી 57'0' = 48, 0 નહીં
space32દેખાય નહીં પણ છે તો ખરો
Enter (CR)13એક control character

Quiz

A = 65 અને a = 97. Table જોયા વગર, d અક્ષરનો ASCII code શું થાય?

  1. 100
  2. 68
  3. 97
  4. 104
Show the answer

100

d એ lowercase માં ચોથો અક્ષર છે: 97 + 3 = 100. Option B (68) એ capital D છે, અને +32 નો rule આ બંને ને જોડે છે: D = 68, d = 68 + 32 = 100. Exam માં anchors થી બહુ આગળના codes ભાગ્યે જ પૂછે; એ તો એ જ check કરે છે કે તમે anchor થી ચાલીને પહોંચી શકો છો કે નહીં, બરાબર આ જ રીતે.

Think first

એ '5' જે 5 નથી

તમારા keyboard પરના '5' character નો ASCII code 53 છે. પણ arithmetic વાળો number 5 તો ખાલી 5 જ છે. machine આ બંને ને અલગ કેમ રાખે છે? એક phone number વિચારો.

Show the answer

98765... જેવો phone number એ digit characters નું બનેલું text છે, એને તમે ક્યારેય add કે multiply નથી કરતા. Character '5' (53 તરીકે store થાય છે) એ display માટેનું symbol છે; number 5 એ arithmetic માટેની value છે. આ બંને ને ગૂંચવી નાખવાના કારણે જ શરૂઆતના C programs garbage print કરે છે: આ જ exact distinction BCA104 માં જોરથી પાછું આવે છે, જ્યાં '5' અને 5 બહુ જ અલગ વસ્તુઓ ગણાય છે.

Watch out

ક્યાં marks ગુમાવો છો

'0' નો code 0 લખી નાખવો: character '0' એ 48 છે; code 0 એ NUL control character છે. Case ના anchors ગૂંચવવા: capital A = 65, small a = 97, અને gap exact 32 નો છે. અને ASCII એ 7-bit/128 characters છે; 8-bit/256 વાળો આંકડો ANSI (અને extended ASCII) નો છે, અને examiner આ distinction one-mark questions થી check કરે છે.

Theory

English થી આગળ: મોટી list

128 કે 256 slots માં ગુજરાતી, हिंदी, tamil, emoji... આ બધું સમાય જ નહીં. આનો આજનો જવાબ એટલે Unicode, એ જ roll-call વાળો idea પણ એક લાખથી વધારે characters સુધી ફેલાવેલો, અને એની પહેલી 128 entries તરીકે ASCII ને જ રાખેલું. એટલે ASCII ક્યારેય મર્યું નથી; એ તો દુનિયાની character dictionary નું page one બની ગયું. Gri-Learn તમને ગુજરાતી બતાવે છે ને, એ Unicode જ કરી રહ્યું છે.

Summary

Key takeaways

  • Encodings એ characters ને numbers સાથે map કરે છે જેથી text binary machines માં રહી શકે.
  • ASCII: 7 bits, 128 characters; ANSI એને 8 bits, 256 સુધી લંબાવે છે.
  • Anchors: A=65, a=97 (gap 32), '0'=48, space=32, Enter=13.
  • Character '5' (code 53) એ number 5 નથી.
  • Unicode એ જ idea ને દુનિયાની બધી scripts સુધી લંબાવે છે, અને ASCII ને પોતાની શરૂઆત તરીકે રાખે છે.
  • યાદ રાખવાની ટ્રીક: એક જાહેર roll-call, A પાસે 65.

Study this properly

This page is the lesson to read. In Gri-Learn the same topic is a graded deck: the self-checks are scored and your weak topics are tracked. Free to start.

Start this topic

Already have an account? Sign in

More from Basic Computer Architecture

Gri-Learn · syllabus-mapped B.C.A. lessons in English, Hindi and Gujarati

ASCII and ANSI character code · Introduction to Computers · Gri-Learn