Giter VIP home page Giter VIP logo

punycode-cocoa's Introduction

Punycode Cocoa

Build Status

v1.4 (2018) by Nate Weaver (Wevah)
https://derailer.org/
https://github.com/Wevah/Punycode-Cocoa

A simple punycode/IDNA category on NSString, based on code and documentation from RFC 3492 and RFC 3490.

Use this to convert internationalized domain names (IDN) between Unicode and ASCII.

To use in your own projects, all you need is NSStringPunycodeAdditions.h/m. This project includes a sample testing app.

Macros

Define PUNYCODE_COCOA_USE_WEBKIT to have Punycode Cocoa methods call internal WebKit methods instead of the custom implementations. Useful if you're already linking against WebKit, or want additional homograph attack protection. However, this probably won't be allowed on the App Store due to its use of private methods.

Define PUNYCODE_COCOA_USE_ICU to use ICU (by default the system's ICU).

Methods

NSString

@property (readonly, copy, nullable)	NSString *punycodeEncodedString;
@property (readonly, copy, nullable)	NSString *punycodeDecodedString;

Encodes or decodes a string to its punycode-encoded format, stripping variation selectors (U+FE00U+FE0F).

@property (readonly, copy, nullable) NSString *IDNAEncodedString;

If self contains non-ASCII, calls -punycodeEncodedString and prepends xn--.

@property (readonly, copy, nullable) NSString *IDNADecodedString;

Decodes a string returned by -IDNAEncodedString.

@property (readonly, copy, nullable) NSString *encodedURLString;
@property (readonly, copy, nullable) NSString *decodedURLString;

Performs encode/decode operations on each appropriate part (the domain bits) of an URL string.

NSURL

+ (nullable instancetype)URLWithUnicodeString:(NSString *)URLString;

Convenience method equivalent to [NSURL URLWithString:URLString.encodedURLString].

@property (readonly, copy, nullable) NSString *decodedURLString;

Convenience property equivalent to anURL.absoluteString.decodedURLString.


© 2012–2017 Nate Weaver (Wevah)

punycode-cocoa's People

Contributors

wevah avatar orkoden avatar wirthcaesar avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.