Skip to content

Punycode encoding and decoding in MoonBit

License

Unlicense, Apache-2.0 licenses found

Licenses found

Unlicense
UNLICENSE
Apache-2.0
LICENSE-APACHE
Notifications You must be signed in to change notification settings

chawyehsu/punycode.mbt

punycode.mbt

Punycode encoding and decoding in MoonBit

ci version-svg license

Installation

Add the library to your project as a dependency:

moon add chawyehsu/punycode

API

⚠️ The API is subject to change before the MoonBit language enters the mature stage.

punycode.encode(input: String): String?

Encode a string of Unicode symbols to a Punycode string of ASCII-only symbols.

@punycode.encode("bücher") // Some("bcher-kva")

punycode.decode(input: String): String?

Decode a Punycode string of ASCII-only symbols to a string of Unicode symbols.

@punycode.decode("bcher-kva") // Some("bücher")

Contributing

The codebase might not yet be updated to support the latest version of MoonBit language. An explicit version of the MoonBit toolchain has been pinned in the moonbit-version file, which is used by the moonup tool.

moonup pin toolchain-version

To contribute, it is suggested to use moonup to manage the MoonBit toolchain:

References

  • RFC 3492 - Punycode: A Bootstring encoding of Unicode for Internationalized Domain Names in Applications (IDNA)
  • punycode.c - The original C reference implementation of Punycode in RFC 3492

License

punycode.mbt © Chawye Hsu. Licensed under either of the Apache License 2.0 or The Unlicense license at your option.

Blog · GitHub @chawyehsu · Twitter @chawyehsu

About

Punycode encoding and decoding in MoonBit

Topics

Resources

License

Unlicense, Apache-2.0 licenses found

Licenses found

Unlicense
UNLICENSE
Apache-2.0
LICENSE-APACHE

Code of conduct

Stars

Watchers

Forks