Dành: Tính năng này không còn được khuyến nghị. Mặc dù một số trình duyệt vẫn có thể hỗ trợ nó, nhưng nó có thể đã bị xóa khỏi các tiêu chuẩn web có liên quan, có thể đang trong quá trình bị loại bỏ hoặc chỉ có thể được giữ cho mục đích tương thích. Tránh sử dụng nó và cập nhật mã hiện có nếu có thể; Xem bảng tương thích ở cuối trang này để hướng dẫn quyết định của bạn. Xin lưu ý rằng tính năng này có thể ngừng hoạt động bất cứ lúc nào. This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the
compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time. CẢNH BÁO: Mặc dù Tất cả các tính năng và hành vi ngôn ngữ được chỉ định trong phụ lục này có một hoặc nhiều đặc điểm không mong muốn và trong trường hợp không sử dụng di sản sẽ bị xóa khỏi đặc điểm kỹ thuật này. Các lập trình viên không nên sử dụng hoặc cho rằng sự tồn tại của các tính năng và hành vi này khi viết mã Ecmascript mới. …unescape[]
không bị phản đối nghiêm ngặt [như trong "bị xóa khỏi các tiêu chuẩn web"], nhưng nó được định nghĩa trong Phụ lục B của tiêu chuẩn ECMA-262, có trạng thái giới thiệu: Although unescape[]
is not strictly deprecated [as in "removed from the Web standards"], it is defined in
Annex B of the ECMA-262 standard, whose introduction states:
Hàm unescape[]
tính toán một chuỗi mới trong đó các chuỗi thoát thập lục phân được thay thế bằng ký tự mà nó đại diện. Các chuỗi thoát có thể được giới thiệu bởi một chức năng như escape
. Thông thường, decodeURI
hoặc decodeURIComponent
được ưu tiên hơn unescape
.unescape[]
function computes a new string in which hexadecimal escape sequences are replaced with the character that it represents. The escape sequences might be introduced by a function like escape
. Usually,
decodeURI
or decodeURIComponent
are preferred over unescape
.
Lưu ý: Không sử dụng unescape
để giải mã URI, sử dụng decodeURI
thay thế. Do not use unescape
to decode URIs, use decodeURI
instead.
Cú pháp
Thông số
Geeks for Geeks!!! To contribute articles contact us at2
Một chuỗi được giải mã.
Giá trị trả về
Một chuỗi mới trong đó một số ký tự đã được không được phân loại.
Sự mô tả
Hàm unescape
là một thuộc tính của đối tượng toàn cầu.
Ví dụ
Sử dụng unescape
unescape["abc123"]; // "abc123"
unescape["%E4%F6%FC"]; // "äöü"
unescape["%u0107"]; // "ć"
Thông số kỹ thuật
Đặc tả ngôn ngữ Ecmascript # Sec-Unescape-String # sec-unescape-string |
Tính tương thích của trình duyệt web
Bảng BCD chỉ tải trong trình duyệt
Xem thêm
Hàm UNESCAPE được sử dụng trong JavaScript để giải mã một chuỗi được mã hóa bằng hàm mã hóa hoặc để giải mã các loại chuỗi được mã hóa khác, chẳng hạn như URL. Ví dụ: JavaScript bên dưới sẽ mã hóa và sau đó giải mã một chuỗi.
Xem thảo luận
Cải thiện bài viết
Hàm UNESCAPE được sử dụng trong JavaScript để giải mã một chuỗi được mã hóa bằng hàm mã hóa hoặc để giải mã các loại chuỗi được mã hóa khác, chẳng hạn như URL. Ví dụ: JavaScript bên dưới sẽ mã hóa và sau đó giải mã một chuỗi.
Xem thảo luận
Cải thiện bài viết
Lưu bài viết JavaScript escape[] Function
Đọcunescape[] function.
- Example:
Geeks for Geeks!!! To contribute articles contact us at
4Geeks for Geeks!!! To contribute articles contact us at
5Geeks for Geeks!!! To contribute articles contact us at
6Geeks for Geeks!!! To contribute articles contact us at
7Geeks for Geeks!!! To contribute articles contact us at
8Geeks for Geeks!!! To contribute articles contact us at
5unescape[string]
0unescape[string]
1unescape[string]
2Geeks for Geeks!!! To contribute articles contact us at
5Geeks for Geeks!!! To contribute articles contact us at
6unescape[string]
5unescape[string]
6unescape[string]
7unescape[string]
8Geeks for Geeks!!! To contribute articles contact us at
8Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20at%20 Decoded : To contribute articles contact us at
0 - Output:
Geeks for Geeks!!! To contribute articles contact us at
Geeks for Geeks!!! To contribute articles contact us at
Hàm unescape [] trong javascript lấy một chuỗi làm tham số và sử dụng để giải mã chuỗi đó được mã hóa bởi hàm Escape []. Trình tự thập lục phân trong chuỗi được thay thế bằng các ký tự mà chúng đại diện khi được giải mã thông qua unescape [].unescape[] function in JavaScript takes a string as a parameter and uses to decode that string encoded by the escape[] function. The hexadecimal sequence in the string is replaced by the characters they represent when decoded via unescape[].
Syntax:
unescape[string]
Tham số: Hàm này chấp nhận một tham số duy nhất như đã đề cập ở trên và được mô tả dưới đây: This function accepts a single parameter as mentioned above and described below:
- Chuỗi: Các tham số này giữ chuỗi sẽ được giải mã. This parameters holds the string that will be decoded.
Giá trị trả về: Hàm này trả về một chuỗi được giải mã. This function returns a decoded string.
Lưu ý: Hàm này chỉ giải mã các ký tự đặc biệt, hàm này bị tước bỏ. / * _ This function only decodes the special characters, this function is depricated.
Exceptions: @ – + . / * _Thêm mã ví dụ cho hàm trên như sau: Chương trình 1:
Program 1:Geeks for Geeks!!! To contribute articles contact us at
4Geeks for Geeks!!! To contribute articles contact us at
5Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20at%20 Decoded : To contribute articles contact us at
3Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20at%20 Decoded : To contribute articles contact us at
4Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20at%20 Decoded : To contribute articles contact us at
5unescape[string]
2Geeks for Geeks!!! To contribute articles contact us at
5unescape[string]
0Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20at%20 Decoded : To contribute articles contact us at
9unescape[]
0Geeks for Geeks!!! To contribute articles contact us at
5unescape[string]
0unescape[string]
1unescape[string]
2Geeks for Geeks!!! To contribute articles contact us at
5unescape[string]
0unescape[]
7unescape[]
8Geeks for Geeks!!! To contribute articles contact us at
5unescape[string]
0unescape[]
1unescape[string]
2Geeks for Geeks!!! To contribute articles contact us at
5Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20at%20 Decoded : To contribute articles contact us at
4unescape[]
5unescape[]
6unescape[]
7unescape[]
8unescape[]
9Geeks for Geeks!!! To contribute articles contact us at
5unescape[string]
0Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20at%20 Decoded : To contribute articles contact us at
9unescape[]
0Geeks for Geeks!!! To contribute articles contact us at
5unescape[string]
0unescape[string]
1unescape[string]
2Geeks for Geeks!!! To contribute articles contact us at
5unescape[string]
0unescape[]
7unescape[]
8decodeURI
2Output:
Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20at%20 Decoded : To contribute articles contact us at
Geeks for Geeks!!! To contribute articles contact us at
5Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20at%20 Decoded : To contribute articles contact us at
4unescape[]
5unescape[]
6- Các trình duyệt được hỗ trợ:
- Google Chrome 1 trở lên
- Cạnh 12 trở lên
- Internet Explorer 3 trở lên
- Mozilla Firefox 1 trở lên
- Safari 1 trở lên