Skip to content
This repository has been archived by the owner on Apr 9, 2022. It is now read-only.
/ punyencode Public archive

A simple CLI tool to encode a string to punycode

License

Notifications You must be signed in to change notification settings

jonasbn/punyencode

Repository files navigation

punyencode

This repository has been archived in favor of punycode.

Coverage Status

A simple CLI tool to encode a string to a punycode encoded string

Usage

Encoding a single string, meaning conversion from human readable text to punycode

punyencode blåbærgrød

Will emit

xn--blbrgrd-fxak7p

As an alternative to provided arguments, you can pipe text into punyencode

echo blåbærgrød | punydencode

Will emit

xn--blbrgrd-fxak7p

Installation

Installation is easy using Go

go install github.com/jonasbn/punyencode@latest

If you want a particular version, please see Go Modules Reference

Description

If you want to decode from punycode, see punydecode.

Diagnostics

Exit Status

  • 0 success, provided string has been decoded and printed

  • 1 failure no argument provided or data from STDIN

  • 2 failure reading from STDIN

Dependencies

This utility requires:

In addition to a few of the standard libraries

Bugs and Limitations

There a no known bugs, please see the GitHub repository issues section for a up to date listing.

Only support for Unicode

The utility is limited to decoding to Unicode (version 13) from Punycode.

Please see golang.org/x/net/idna for details.

Only a single argument

punyencode only takes a single argument.

punyencode kødpålæg

Author

  • jonasbn

Motivation

This utility was created, when in the process of learning Go. I have worked in the DNS and domain name business for a decade so it was only natural to work on something I know when learning Go.

This particular repository touched the following topics:

  1. Learning to make CLI tools
  2. Making an executable distributable and installable component
  3. Reading data from the CLI
  4. Reading data from STDIN
  5. Testing a CLI tool / Main function in Go

See the resources and references below for resources on the above topics.

Resources and References

  1. Wikipedia: Punycode
  2. Go Modules Reference
  3. [GitHub: punyencode][punyencode]
  4. golang.org/x/net/idna
  5. yourbasic.org/golang: Read a file (stdin) line by line
  6. Blog post: Test the main function in Go by Johannes Malsam

License and Copyright

Copyright Jonas Brømsø (jonasbn) 2022

MIT License, see separate LICENSE file

About

A simple CLI tool to encode a string to punycode

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages