---
schema_version: "1"
id: 98e67ab9f21e04b03580205f77765981ea6bd8fdc60c284c7257728f9c64d896
title: encodeURIComponent
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.5/dw-url-functions-encodeuricomponent.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.5/dw-url-functions-encodeuricomponent
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 8b5bdcec37cf2a4428cdfbf47eddcec9615e3249999e3269fd414126ec63ee5c
description: MuleSoft Documentation Site
release: "2.5"
latest: false
---
# encodeURIComponent

## [](#encodeuricomponent1)encodeURIComponent(text: String): String

UTF-8 エンコーディングを使用して、URI コンポーネント内の特定の文字をエスケープします。

2 つのサロゲート文字で構成される文字には、4 つのエスケープシーケンスのみを使用できます。 `encodeURIComponent`​ は、アルファベット、10 進数、​`- _ . ! ~ * ' ( )`​ を​_除く_​すべての文字をエスケープします。 `encodeURIComponent`​ は ​`encodeURI`​ とは異なり、​`encodeURI`​ の予約文字と番号記号 ​`#`​ をエンコードします。

<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">型</th>
<th class="tableblock halign-left valign-top">含まれるもの</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">予約文字</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">エスケープされない文字</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">アルファベット、10 進数、- _ . ! ~ * ' ( )</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">番号記号</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>

### [](#パラメーター)パラメーター

<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 25%;">
<col style="width: 75%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">名前</th>
<th class="tableblock halign-left valign-top">説明</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>text</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">URI コンポーネント文字列。</p></td>
</tr>
</tbody>
</table>

### [](#例)例

次の例では、さまざまな URI コンポーネントをエンコードします。

#### [](#ソース)ソース

```DataWeave
%dw 2.0
import * from dw::core::URL
output application/json
---
{
  "comparing_encode_functions_output" : {
  	"encodeURIComponent" : encodeURI(" PATH/ TO /ENCODE "),
  	"encodeURI" : encodeURI(" PATH/ TO /ENCODE "),
  	"encodeURIComponent_to_hex" : encodeURIComponent(";,/?:@&="),
  	"encodeURI_not_to_hex" : encodeURI(";,/?:@&="),
  	"encodeURIComponent_not_encoded" : encodeURIComponent("-_.!~*'()"),
  	"encodeURI_not_encoded" : encodeURI("-_.!~*'()")
  }
}
```

#### [](#出力)出力

```JSON
{
  "comparing_encode_functions_output": {
    "encodeURIComponent": "%20PATH/%20TO%20/ENCODE%20",
    "encodeURI": "%20PATH/%20TO%20/ENCODE%20",
    "encodeURIComponent_to_hex": "%3B%2C%2F%3F%3A%40%26%3D",
    "encodeURI_not_to_hex": ";,/?:@&=",
    "encodeURIComponent_not_encoded": "-_.!~*'()",
    "encodeURI_not_encoded": "-_.!~*'()"
  }
}
```