با عرض سلام خدمت کاربران سایت پی وی لرن . در مطالب آموزشی که تاکنون ارائه شده ، در موضوع نمایش کاراکتر ها و نماد های خاص در html ، به ارائه موضوعاتی در این زمینه پرداختیم. اکنون در این بخش نیز در ادامه موضوعاتی که به آنها اشاره کردیم ، قصد داریم به موضوع آموزش کار با ویژگی Encoding در html ( تنظیمات کاراکتر در html ) و کاربرد Encoding در html ، بپردازیم.
برای نمایش صحیح هر وب سایتی ، مرورگر باید تنظیمات کاراکتر و Encoding آن صفحه وب را پشتیبانی کند، تا بتواند از آن استفاده کند. در ادامه آموزش در این بخش ، به ارائه بحث آموزش کار با ویژگی Encoding در html ( تنظیمات کاراکتر ) ، می پردازیم.
ASCII (که معمولا character set نامیده می شود) اولین Encoding استاندارد است. ASCII داری ۱۲۸ نوع کاراکتر از نوع alphanumeric است، که می تواند در اینترنت استفاده شود: اعداد (۹-۰) ، حروف انگلیسی (A-Z) ، و برخی از کاراکترهای خاص نظیر ! $ + – ( ) @ < >.
ANSI نیز استاندارد دیگری است که از ۲۵۶ کاراکتر پشتیبانی می کند ، اما استاندارد UTF-8 تقریبا از تمام کارکترهای جهان ، پشتیبانی می کند.
مرورگرهای با استفاده از تگ <meta> ، تنظیمات کارکتری هر وب سایت را دریافت می کنند.
مثال: در html4:
1 | <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"> |
مثال: در html5:
1 | <meta charset="UTF-8"> |
نکته: اگر یک مرورگر استاندارد ISO-8859-1 را در یک صفحه وب شناسایی کند، آن را به صورت ANSI پیش فرض می کند، زیرا ANSI همانند ISO-8859-1 است.
Numb | ASCII | ANSI | ۸۸۵۹ | UTF-8 | توضیحات |
---|---|---|---|---|---|
۳۲ | space | ||||
۳۳ | ! | ! | ! | ! | exclamation mark |
۳۴ | “ | “ | “ | “ | quotation mark |
۳۵ | # | # | # | # | number sign |
۳۶ | $ | $ | $ | $ | dollar sign |
۳۷ | % | % | % | % | percent sign |
۳۸ | & | & | & | & | ampersand |
۳۹ | ‘ | ‘ | ‘ | ‘ | apostrophe |
۴۰ | ( | ( | ( | ( | left parenthesis |
۴۱ | ) | ) | ) | ) | right parenthesis |
۴۲ | * | * | * | * | asterisk |
۴۳ | + | + | + | + | plus sign |
۴۴ | , | , | , | , | comma |
۴۵ | – | – | – | – | hyphen-minus |
۴۶ | . | . | . | . | full stop |
۴۷ | / | / | / | / | solidus |
۴۸ | ۰ | ۰ | ۰ | ۰ | digit zero |
۴۹ | ۱ | ۱ | ۱ | ۱ | digit one |
۵۰ | ۲ | ۲ | ۲ | ۲ | digit two |
۵۱ | ۳ | ۳ | ۳ | ۳ | digit three |
۵۲ | ۴ | ۴ | ۴ | ۴ | digit four |
۵۳ | ۵ | ۵ | ۵ | ۵ | digit five |
۵۴ | ۶ | ۶ | ۶ | ۶ | digit six |
۵۵ | ۷ | ۷ | ۷ | ۷ | digit seven |
۵۶ | ۸ | ۸ | ۸ | ۸ | digit eight |
۵۷ | ۹ | ۹ | ۹ | ۹ | digit nine |
۵۸ | : | : | : | : | colon |
۵۹ | ; | ; | ; | ; | semicolon |
۶۰ | < | < | < | < | less-than sign |
۶۱ | = | = | = | = | equals sign |
۶۲ | > | > | > | > | greater-than sign |
۶۳ | ? | ? | ? | ? | question mark |
۶۴ | @ | @ | @ | @ | commercial at |
۶۵ | A | A | A | A | Latin capital letter A |
۶۶ | B | B | B | B | Latin capital letter B |
۶۷ | C | C | C | C | Latin capital letter C |
۶۸ | D | D | D | D | Latin capital letter D |
۶۹ | E | E | E | E | Latin capital letter E |
۷۰ | F | F | F | F | Latin capital letter F |
۷۱ | G | G | G | G | Latin capital letter G |
۷۲ | H | H | H | H | Latin capital letter H |
۷۳ | I | I | I | I | Latin capital letter I |
۷۴ | J | J | J | J | Latin capital letter J |
۷۵ | K | K | K | K | Latin capital letter K |
۷۶ | L | L | L | L | Latin capital letter L |
۷۷ | M | M | M | M | Latin capital letter M |
۷۸ | N | N | N | N | Latin capital letter N |
۷۹ | O | O | O | O | Latin capital letter O |
۸۰ | P | P | P | P | Latin capital letter P |
۸۱ | Q | Q | Q | Q | Latin capital letter Q |
۸۲ | R | R | R | R | Latin capital letter R |
۸۳ | S | S | S | S | Latin capital letter S |
۸۴ | T | T | T | T | Latin capital letter T |
۸۵ | U | U | U | U | Latin capital letter U |
۸۶ | V | V | V | V | Latin capital letter V |
۸۷ | W | W | W | W | Latin capital letter W |
۸۸ | X | X | X | X | Latin capital letter X |
۸۹ | Y | Y | Y | Y | Latin capital letter Y |
۹۰ | Z | Z | Z | Z | Latin capital letter Z |
۹۱ | [ | [ | [ | [ | left square bracket |
۹۲ | \ | \ | \ | \ | reverse solidus |
۹۳ | ] | ] | ] | ] | right square bracket |
۹۴ | ^ | ^ | ^ | ^ | circumflex accent |
۹۵ | _ | _ | _ | _ | low line |
۹۶ |
|
| grave accent | ||
۹۷ | a | a | a | a | Latin small letter a |
۹۸ | b | b | b | b | Latin small letter b |
۹۹ | c | c | c | c | Latin small letter c |
۱۰۰ | d | d | d | d | Latin small letter d |
۱۰۱ | e | e | e | e | Latin small letter e |
۱۰۲ | f | f | f | f | Latin small letter f |
۱۰۳ | g | g | g | g | Latin small letter g |
۱۰۴ | h | h | h | h | Latin small letter h |
۱۰۵ | i | i | i | i | Latin small letter i |
۱۰۶ | j | j | j | j | Latin small letter j |
۱۰۷ | k | k | k | k | Latin small letter k |
۱۰۸ | l | l | l | l | Latin small letter l |
۱۰۹ | m | m | m | m | Latin small letter m |
۱۱۰ | n | n | n | n | Latin small letter n |
۱۱۱ | o | o | o | o | Latin small letter o |
۱۱۲ | p | p | p | p | Latin small letter p |
۱۱۳ | q | q | q | q | Latin small letter q |
۱۱۴ | r | r | r | r | Latin small letter r |
۱۱۵ | s | s | s | s | Latin small letter s |
۱۱۶ | t | t | t | t | Latin small letter t |
۱۱۷ | u | u | u | u | Latin small letter u |
۱۱۸ | v | v | v | v | Latin small letter v |
۱۱۹ | w | w | w | w | Latin small letter w |
۱۲۰ | x | x | x | x | Latin small letter x |
۱۲۱ | y | y | y | y | Latin small letter y |
۱۲۲ | z | z | z | z | Latin small letter z |
۱۲۳ | { | { | { | { | left curly bracket |
۱۲۴ | | | | | | | | | vertical line |
۱۲۵ | } | } | } | } | right curly bracket |
۱۲۶ | ~ | ~ | ~ | ~ | tilde |
۱۲۷ | DEL | ||||
۱۲۸ | € | euro sign | |||
۱۲۹ | | | | NOT USED | |
۱۳۰ | ‚ | single low-9 quotation mark | |||
۱۳۱ | ƒ | Latin small letter f with hook | |||
۱۳۲ | „ | double low-9 quotation mark | |||
۱۳۳ | … | horizontal ellipsis | |||
۱۳۴ | † | dagger | |||
۱۳۵ | ‡ | double dagger | |||
۱۳۶ | ˆ | modifier letter circumflex accent | |||
۱۳۷ | ‰ | per mille sign | |||
۱۳۸ | Š | Latin capital letter S with caron | |||
۱۳۹ | ‹ | single left-pointing angle quotation mark | |||
۱۴۰ | Œ | Latin capital ligature OE | |||
۱۴۱ | | | | NOT USED | |
۱۴۲ | Ž | Latin capital letter Z with caron | |||
۱۴۳ | | | | NOT USED | |
۱۴۴ | | | | NOT USED | |
۱۴۵ | ‘ | left single quotation mark | |||
۱۴۶ | ’ | right single quotation mark | |||
۱۴۷ | “ | left double quotation mark | |||
۱۴۸ | ” | right double quotation mark | |||
۱۴۹ | • | bullet | |||
۱۵۰ | – | en dash | |||
۱۵۱ | — | em dash | |||
۱۵۲ | ˜ | small tilde | |||
۱۵۳ | ™ | trade mark sign | |||
۱۵۴ | š | Latin small letter s with caron | |||
۱۵۵ | › | single right-pointing angle quotation mark | |||
۱۵۶ | œ | Latin small ligature oe | |||
۱۵۷ | | | | NOT USED | |
۱۵۸ | ž | Latin small letter z with caron | |||
۱۵۹ | Ÿ | Latin capital letter Y with diaeresis | |||
۱۶۰ | no-break space | ||||
۱۶۱ | ¡ | ¡ | ¡ | inverted exclamation mark | |
۱۶۲ | ¢ | ¢ | ¢ | cent sign | |
۱۶۳ | £ | £ | £ | pound sign | |
۱۶۴ | ¤ | ¤ | ¤ | currency sign | |
۱۶۵ | ¥ | ¥ | ¥ | yen sign | |
۱۶۶ | ¦ | ¦ | ¦ | broken bar | |
۱۶۷ | § | § | § | section sign | |
۱۶۸ | ¨ | ¨ | ¨ | diaeresis | |
۱۶۹ | © | © | © | copyright sign | |
۱۷۰ | ª | ª | ª | feminine ordinal indicator | |
۱۷۱ | « | « | « | left-pointing double angle quotation mark | |
۱۷۲ | ¬ | ¬ | ¬ | not sign | |
۱۷۳ | soft hyphen | ||||
۱۷۴ | ® | ® | ® | registered sign | |
۱۷۵ | ¯ | ¯ | ¯ | macron | |
۱۷۶ | ° | ° | ° | degree sign | |
۱۷۷ | ± | ± | ± | plus-minus sign | |
۱۷۸ | ² | ² | ² | superscript two | |
۱۷۹ | ³ | ³ | ³ | superscript three | |
۱۸۰ | ´ | ´ | ´ | acute accent | |
۱۸۱ | µ | µ | µ | micro sign | |
۱۸۲ | ¶ | ¶ | ¶ | pilcrow sign | |
۱۸۳ | · | · | · | middle dot | |
۱۸۴ | ¸ | ¸ | ¸ | cedilla | |
۱۸۵ | ¹ | ¹ | ¹ | superscript one | |
۱۸۶ | º | º | º | masculine ordinal indicator | |
۱۸۷ | » | » | » | right-pointing double angle quotation mark | |
۱۸۸ | ¼ | ¼ | ¼ | vulgar fraction one quarter | |
۱۸۹ | ½ | ½ | ½ | vulgar fraction one half | |
۱۹۰ | ¾ | ¾ | ¾ | vulgar fraction three quarters | |
۱۹۱ | ¿ | ¿ | ¿ | inverted question mark | |
۱۹۲ | À | À | À | Latin capital letter A with grave | |
۱۹۳ | Á | Á | Á | Latin capital letter A with acute | |
۱۹۴ | Â | Â | Â | Latin capital letter A with circumflex | |
۱۹۵ | Ã | Ã | Ã | Latin capital letter A with tilde | |
۱۹۶ | Ä | Ä | Ä | Latin capital letter A with diaeresis | |
۱۹۷ | Å | Å | Å | Latin capital letter A with ring above | |
۱۹۸ | Æ | Æ | Æ | Latin capital letter AE | |
۱۹۹ | Ç | Ç | Ç | Latin capital letter C with cedilla | |
۲۰۰ | È | È | È | Latin capital letter E with grave | |
۲۰۱ | É | É | É | Latin capital letter E with acute | |
۲۰۲ | Ê | Ê | Ê | Latin capital letter E with circumflex | |
۲۰۳ | Ë | Ë | Ë | Latin capital letter E with diaeresis | |
۲۰۴ | Ì | Ì | Ì | Latin capital letter I with grave | |
۲۰۵ | Í | Í | Í | Latin capital letter I with acute | |
۲۰۶ | Î | Î | Î | Latin capital letter I with circumflex | |
۲۰۷ | Ï | Ï | Ï | Latin capital letter I with diaeresis | |
۲۰۸ | Ð | Ð | Ð | Latin capital letter Eth | |
۲۰۹ | Ñ | Ñ | Ñ | Latin capital letter N with tilde | |
۲۱۰ | Ò | Ò | Ò | Latin capital letter O with grave | |
۲۱۱ | Ó | Ó | Ó | Latin capital letter O with acute | |
۲۱۲ | Ô | Ô | Ô | Latin capital letter O with circumflex | |
۲۱۳ | Õ | Õ | Õ | Latin capital letter O with tilde | |
۲۱۴ | Ö | Ö | Ö | Latin capital letter O with diaeresis | |
۲۱۵ | × | × | × | multiplication sign | |
۲۱۶ | Ø | Ø | Ø | Latin capital letter O with stroke | |
۲۱۷ | Ù | Ù | Ù | Latin capital letter U with grave | |
۲۱۸ | Ú | Ú | Ú | Latin capital letter U with acute | |
۲۱۹ | Û | Û | Û | Latin capital letter U with circumflex | |
۲۲۰ | Ü | Ü | Ü | Latin capital letter U with diaeresis | |
۲۲۱ | Ý | Ý | Ý | Latin capital letter Y with acute | |
۲۲۲ | Þ | Þ | Þ | Latin capital letter Thorn | |
۲۲۳ | ß | ß | ß | Latin small letter sharp s | |
۲۲۴ | à | à | à | Latin small letter a with grave | |
۲۲۵ | á | á | á | Latin small letter a with acute | |
۲۲۶ | â | â | â | Latin small letter a with circumflex | |
۲۲۷ | ã | ã | ã | Latin small letter a with tilde | |
۲۲۸ | ä | ä | ä | Latin small letter a with diaeresis | |
۲۲۹ | å | å | å | Latin small letter a with ring above | |
۲۳۰ | æ | æ | æ | Latin small letter ae | |
۲۳۱ | ç | ç | ç | Latin small letter c with cedilla | |
۲۳۲ | è | è | è | Latin small letter e with grave | |
۲۳۳ | é | é | é | Latin small letter e with acute | |
۲۳۴ | ê | ê | ê | Latin small letter e with circumflex | |
۲۳۵ | ë | ë | ë | Latin small letter e with diaeresis | |
۲۳۶ | ì | ì | ì | Latin small letter i with grave | |
۲۳۷ | í | í | í | Latin small letter i with acute | |
۲۳۸ | î | î | î | Latin small letter i with circumflex | |
۲۳۹ | ï | ï | ï | Latin small letter i with diaeresis | |
۲۴۰ | ð | ð | ð | Latin small letter eth | |
۲۴۱ | ñ | ñ | ñ | Latin small letter n with tilde | |
۲۴۲ | ò | ò | ò | Latin small letter o with grave | |
۲۴۳ | ó | ó | ó | Latin small letter o with acute | |
۲۴۴ | ô | ô | ô | Latin small letter o with circumflex | |
۲۴۵ | õ | õ | õ | Latin small letter o with tilde | |
۲۴۶ | ö | ö | ö | Latin small letter o with diaeresis | |
۲۴۷ | ÷ | ÷ | ÷ | division sign | |
۲۴۸ | ø | ø | ø | Latin small letter o with stroke | |
۲۴۹ | ù | ù | ù | Latin small letter u with grave | |
۲۵۰ | ú | ú | ú | Latin small letter u with acute | |
۲۵۱ | û | û | û | Latin small letter with circumflex | |
۲۵۲ | ü | ü | ü | Latin small letter u with diaeresis | |
۲۵۳ | ý | ý | ý | Latin small letter y with acute | |
۲۵۴ | þ | þ | þ | Latin small letter thorn | |
۲۵۵ | ÿ | ÿ | ÿ | Latin small letter y with diaeresis |
ASCII از مقادیر ۰ تا ۳۱ (و ۱۲۷) برای کاراکترهای کنترل استفاده می کند.
ASCII از مقادیر ۳۲ تا ۱۲۶ برای حروف، ارقام و نمادها استفاده می کند.
ASCII از مقادیر ۱۲۸ تا ۲۵۵ استفاده نمی کند.
ANSI برای مقادیر ۰ تا ۱۲۷ برابر با ASCII است.
ANSI مجموعه ای از کاراکتر اختصاصی برای مقادیر ۱۲۸ تا ۱۵۹ دارد.
ANSI برای مقادیر ۱۶۰ تا ۲۵۵ برابر با UTF-8 است.
۸۸۵۹-۱ برای مقادیر ۰ تا ۱۲۷ برابر با ASCII است.
۸۸۵۹-۱ از مقادیر ۱۲۸ تا ۱۵۹ استفاده نمی کند.
۸۸۵۹-۱ برای مقادیر ۱۶۰ تا ۲۵۵ برابر با UTF-8 است.
UTF-8 برای مقادیر ۰ تا ۱۲۷ برابر با ASCII است.
UTF-8 از مقادیر ۱۲۸ تا ۱۵۹ استفاده نمی کند.
UTF-8 برای مقادیر ۱۶۰ تا ۲۵۵ برابر با هر دو ANSI و ۸۸۵۹-۱ است.
UTF-8 همچنان از مقدار ۲۵۶ با بیش از ۱۰ هزار کاراکتر متفاوت ادامه می یابد.
شما می توانید از خصوصیت @charset در css ، برای تعریف Encoding ، استفاده کنید.
مثال: تعریف استاندارد UTF-8 در css:
1 | @charset "UTF-8"; |
در این مبحث طرز کار با ویژگی Encoding در html و صفت charset در html را ارائه کردیم. تا با انواع استانداردهای زبان و کاراکتری در html و نحوه تنظیم آن ها آشنا شوید.