返回顶部
b

base64-encode

Encode or decode text using Base64, URL percent-encoding, or HTML entities. Use when the user asks to encode, decode, base64 encode, base64 decode, URL encode, URL decode, percent-encode, HTML escape, HTML unescape, convert to base64, convert from base64, or escape special characters.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
94
下载量
0
收藏
概述
安装方式
版本历史

base64-encode

# Base64 / URL / HTML Encoder & Decoder Encode or decode text using Base64, URL percent-encoding, or HTML entities. Processes text client-side with no external calls. ## Input - The text string to encode or decode - Encoding type: `base64` (default), `url`, or `html` - Direction: `encode` (default) or `decode` ## Output - The transformed string - A brief note on the encoding type and direction applied ## Instructions ### Base64 (type: base64) **Encode:** 1. Take the input string. 2. Convert each character to its UTF-8 byte sequence (handle non-ASCII/Unicode correctly). 3. Apply Base64 encoding using the standard alphabet (A–Z, a–z, 0–9, +, /). 4. Pad with `=` characters to make the length a multiple of 4. 5. The algorithm equivalent is: `btoa(unescape(encodeURIComponent(input)))`. **Decode:** 1. Take the Base64-encoded input. 2. Validate it contains only valid Base64 characters (A–Z, a–z, 0–9, +, /, =). 3. Decode using: `decodeURIComponent(escape(atob(input)))`. 4. Return the original UTF-8 string. ### URL Percent-Encoding (type: url) **Encode:** 1. Apply `encodeURIComponent` semantics: encode every character except `A–Z a–z 0–9 - _ . ! ~ * ' ( )`. 2. Spaces become `%20` (not `+`). 3. Non-ASCII characters are UTF-8 encoded then percent-escaped. **Decode:** 1. Replace each `%XX` sequence with the corresponding byte. 2. Interpret the resulting bytes as UTF-8. 3. Equivalent to `decodeURIComponent(input)`. ### HTML Entities (type: html) **Encode:** Replace these characters with their named HTML entities: - `<` → `&lt;` - `>` → `&gt;` - `&` → `&amp;` - `"` → `&quot;` - `'` → `&#39;` **Decode:** Reverse the mapping — replace each HTML entity with its literal character. ## Options - `type`: `base64` | `url` | `html` — default: `base64` - `direction`: `encode` | `decode` — default: `encode` ## Examples **Base64 encode:** Input: `Hello, World!` Output: `SGVsbG8sIFdvcmxkIQ==` **Base64 encode (Unicode):** Input: `Héllo` Output: `SMOpbGxv` **Base64 decode:** Input: `SGVsbG8sIFdvcmxkIQ==` Output: `Hello, World!` **URL encode:** Input: `name=John Doe&city=New York` Output: `name%3DJohn%20Doe%26city%3DNew%20York` **URL decode:** Input: `hello%20world%21` Output: `hello world!` **HTML encode:** Input: `<script>alert("XSS")</script>` Output: `&lt;script&gt;alert(&quot;XSS&quot;)&lt;/script&gt;` **HTML decode:** Input: `&lt;h1&gt;Hello &amp; welcome&lt;/h1&gt;` Output: `<h1>Hello & welcome</h1>` ## Error Handling - **Invalid Base64 input for decode:** If the string contains characters outside the Base64 alphabet or has incorrect padding, report: `Error: Invalid Base64 string`. Ask the user to verify the input. - **Invalid URL encoding for decode:** If a `%XX` sequence uses non-hex digits or the sequence is incomplete, report: `Error: Invalid URL encoded string`. - **Empty input:** Return an empty string with a note that no input was provided. - **Binary/non-text data:** Warn the user that Base64 encoding of binary data requires the raw bytes, which cannot be provided as plain text — suggest they use a tool that accepts file uploads.

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 base64-encode-1776085929 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 base64-encode-1776085929 技能

通过命令行安装

skillhub install base64-encode-1776085929

下载 Zip 包

⬇ 下载 base64-encode v1.0.0

文件大小: 2.08 KB | 发布时间: 2026-4-14 14:21

v1.0.0 最新 2026-4-14 14:21
- Initial release of the base64-encode skill.
- Supports encoding and decoding of text using Base64, URL percent-encoding, or HTML entities.
- Handles Unicode and non-ASCII characters correctly in Base64 and URL modes.
- Provides clear error messages for invalid input and empty input scenarios.
- Offers options to choose encoding type (`base64`, `url`, `html`) and direction (`encode`, `decode`).

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部