Smart.Framework Logo

final class \SmartPunycode
{ } ->

Class: SmartPunycode - provides a IDN Converter using the Punycode implementation as described in RFC 3492 (http://tools.ietf.org/html/rfc3492).


class Methods

public function __construct ( ) {} @ 
@param: {string} $encoding: Character encoding
Constructor
public function encode ( string $input ) {} -> STRING
@return: {string} Punycode representation in ASCII
@param: {string} $input: Domain name in Unicode to be encoded
Encode a domain name or email address to its Punycode version
public function decode ( string $input ) {} -> STRING
@return: {string} Unicode domain name
@param: {string} $input: Domain name in Punycode
Decode a Punycode domain name or email address to its Unicode counterpart

class Properties


class Constants


Sample code: PHP

<?php

$domain_iso         = (string) (new SmartPunycode())->encode('jösefsson.tßst123.org'); // outputs: xn--jsefsson-n4a.xn--tst123-bta.org
 $domain_unicode     = (string) (new SmartPunycode())->decode('xn--jsefsson-n4a.xn--tst123-bta.org'); // outputs: jösefsson.tßst123.org

 $email_iso         = (string) (new SmartPunycode())->encode('räksmörgås@jösefsson.tßst123.org'); // outputs: xn--rksmrgs@jsefsson-vnbx43ag.xn--tst123-bta.org
 $email_unicode     = (string) (new SmartPunycode())->decode('xn--rksmrgs@jsefsson-vnbx43ag.xn--tst123-bta.org'); // outputs: räksmörgås@jösefsson.tßst123.org

// #end php code


documentation generated on: 2024-12-16 17:13:19 +0000


Smart.Framework © 2009-2024 unix-world.org