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
| Character | Code | કઈ રીતે યાદ રાખવું |
|---|---|---|
| A થી Z | 65 થી 90 | A = 65, આ જ anchor |
| a થી z | 97 થી 122 | capital + 32 |
| 0 થી 9 | 48 થી 57 | '0' = 48, 0 નહીં |
| space | 32 | દેખાય નહીં પણ છે તો ખરો |
| Enter (CR) | 13 | એક control character |
Quiz
A = 65 અને a = 97. Table જોયા વગર, d અક્ષરનો ASCII code શું થાય?
- 100
- 68
- 97
- 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.