urlencode

command module
v0.0.0-...-9aa9c6b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2025 License: Unlicense Imports: 5 Imported by: 0

README

URL Encoder/Decoder CLI Tool

A minimal command-line tool that performs URL encoding and decoding, similar to the base64 utility. It reads from standard input and writes to standard output.

Installation

go install github.com/Gubarz/urlencode@latest

Usage

URL Encoding
# Encode a string
echo "Hello World!" | urlencode
# Output: Hello+World%21

# Encode a URL
echo "https://example.com/path?query=value&another=value" | urlencode
# Output: https%3A%2F%2Fexample.com%2Fpath%3Fquery%3Dvalue%26another%3Dvalue

# Double Encode a URL
echo "https://example.com/path?query=value&another=value" | urlencode | urlencode
# Output: https%253A%252F%252Fexample.com%252Fpath%253Fquery%253Dvalue%2526another%253Dvalue

# Encode from a file
cat input.txt | urlencode > encoded.txt
URL Decoding
# Decode a string
echo "Hello+World%21" | urlencode -d
# Output: Hello World!

# Decode a URL
echo "https%3A%2F%2Fexample.com%2Fpath%3Fquery%3Dvalue%26another%3Dvalue" | urlencode -d
# Output: https://example.com/path?query=value&another=value

# Double Decode a URL
echo "https%253A%252F%252Fexample.com%252Fpath%253Fquery%253Dvalue%2526another%253Dvalue" | urlencode -d | urlencode -d
# Output: https://example.com/path?query=value&another=value

# Decode from a file
cat encoded.txt | urlencode -d > decoded.txt

Features

  • Processes input line-by-line
  • Handles special characters and Unicode
  • Similar interface to the base64 command

Development

Testing
# Run tests
go test urlencode.go urlencode_test.go
Building
# Build for current platform
go build -o urlencode

# Cross-compile for different platforms
GOOS=windows GOARCH=amd64 go build -o urlencode.exe
GOOS=darwin GOARCH=amd64 go build -o urlencode-mac

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Documentation

Overview

urlencode is a minimal CLI tool that mimics base64 behavior for URL encoding/decoding. It reads from stdin and writes to stdout. Use -d to decode URL-encoded input.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL