You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 4-binary/02-text-decoder/article.md
+16-16Lines changed: 16 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,30 +1,30 @@
1
-
# TextDecoder and TextEncoder
1
+
# رمزگشای متن و رمزگذار متن
2
2
3
-
What if the binary data is actually a string? For instance, we received a file with textual data.
3
+
اگر دادهی دودویی ما درواقع یک رشته باشد چه؟ برای نمونه، ما یک فایل با دادهی متنی دریافت میکنیم.
4
4
5
-
The built-in [TextDecoder](https://encoding.spec.whatwg.org/#interface-textdecoder) object allows one to read the value into an actual JavaScript string, given the buffer and the encoding.
5
+
شی رمزگشای متن([TextDecoder](https://encoding.spec.whatwg.org/#interface-textdecoder)) درونی، به یک نفر اجازه میدهد که با توجه به بافر و رمزگذاری داده شده، مقدار را در یک رشتهی واقعی جاوااسکریپت بخواند.
6
6
7
-
We first need to create it:
7
+
ابتدا ما نیاز به ساخت آن داریم:
8
8
```js
9
9
let decoder =newTextDecoder([label], [options]);
10
10
```
11
11
12
-
-**`label`** -- the encoding, `utf-8` by default, but `big5`, `windows-1251` and many other are also supported.
13
-
-**`options`** -- optional object:
14
-
-**`fatal`** -- boolean, if `true` then throw an exception for invalid (non-decodable) characters, otherwise (default) replace them with character `\uFFFD`.
15
-
-**`ignoreBOM`** -- boolean, if `true` then ignore BOM (an optional byte-order Unicode mark), rarely needed.
12
+
-**`label`** -- و برخی دیگر از رمزگذارایها نیز پشتیبانی میشوند `windows-1251` و `big5` است اما `utf-8` رمزگذاری، به طور پیش فرض
13
+
-**`options`** -- :شی اختیاری
14
+
-**`fatal`** -- جایگذاری میکند `\uFFFD` برای کاراکتر غیرقابل قبول (غیرقابل رمزگشایی) پرتاب میشود. در غیر این صورت (که حالت پیشفرض میباشد)، آنها را با کاراکتر (exception)باشد، یک استثنا `true` اگر مقدار آن .boolean از جنس
15
+
-**`ignoreBOM`** -- اختیاری مرتب شده برحسب بایت) که به ندرت به آن نیاز پیدا میشود را نادیده میگیرد unicode یک علامت)BOM ،باشد `true` اگر مقدار آن .boolean از جنس
16
16
17
-
...And then decode:
17
+
...و سپس رمزگشایی کنید:
18
18
19
19
```js
20
20
let str =decoder.decode([input], [options]);
21
21
```
22
22
23
-
-**`input`** -- `BufferSource` to decode.
24
-
-**`options`** -- optional object:
25
-
-**`stream`** -- true for decoding streams, when `decoder` is called repeatedly with incoming chunks of data. In that case a multi-byte character may occasionally split between chunks. This options tells `TextDecoder` to memorize "unfinished" characters and decode them when the next chunk comes.
23
+
-**`input`** -- برای رمزگشایی (`BufferSource`)منبع
24
+
-**`options`** -- :شی اختیاری
25
+
-**`stream`** -- ها، هنگامی که رمزگشا برای مقادیر قابل توجه دادهها مکررا فراخوانی میشود، درست است. در این مورد، ممکن است یک کاراکتر چند بایتی، برخی مواقع بین بخشهایی از دادهها تقسیم شود. این امکان به رمزگشای متن میگوید که کاراکترهای "ناتمام" را به خاطر داشته باشد و هنگامی که بخش بعدی داده وارد شد، آنها را رمزگشایی کندstream برای رمزگشایی
26
26
27
-
For instance:
27
+
برای نمونه:
28
28
29
29
```js run
30
30
let uint8Array =newUint8Array([72, 101, 108, 108, 111]);
@@ -39,14 +39,14 @@ let uint8Array = new Uint8Array([228, 189, 160, 229, 165, 189]);
0 commit comments