A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/decodeURI below:

decodeURI() - JavaScript | MDN

decodeURI()

Baseline Widely available

decodeURI() 関数は、encodeURI() 関数あるいは同様のルーチンによって事前に作成された URI (Uniform Resource Identifier; 統一資源識別子) をデコードします。

試してみましょう
const uri = "https://mozilla.org/?x=шеллы";
const encoded = encodeURI(uri);
console.log(encoded);
// Expected output: "https://mozilla.org/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B"

try {
  console.log(decodeURI(encoded));
  // Expected output: "https://mozilla.org/?x=шеллы"
} catch (e) {
  // Catches a malformed URI
  console.error(e);
}
構文 引数
encodedURI

完全にエンコードされた URI。

返値

与えられたエンコードされた統一資源識別子 (URI) のエンコードされていないバージョンを表す新しい文字列。

例外

encodedURI が無効な文字の並びを含む場合、URIError ("malformed URI sequence") 例外が発生します。

解説

エンコードされた URI のエスケープシーケンスを、それぞれが表す文字に置き換えます。ただし、encodeURI によって生成されないエスケープシーケンスはデコードしません。また、"#" の文字はエスケープシーケンスからデコードされません。

使用例 キリル文字の URL をデコード
decodeURI(
  "https://developer.mozilla.org/ru/docs/JavaScript_%D1%88%D0%B5%D0%BB%D0%BB%D1%8B",
);
// "https://developer.mozilla.org/ru/docs/JavaScript_шеллы"
エラーの捕捉
try {
  var a = decodeURI('%E0%A4%A');
} catch(e) {
  console.error(e);
}

// URIError: malformed URI sequence
仕様書 ブラウザーの互換性 関連情報

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4