Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3/4TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

DataFlex Examples

Web API Categories

ASN.1
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Service Bus
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Compression
DKIM / DomainKey
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
ECC
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
Geolocation
Google APIs
Google Calendar
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text

HTTP
HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
Microsoft Graph
NTLM
OAuth1
OAuth2
OneDrive
OpenSSL
Outlook
PEM
PFX/P12
POP3
PRNG
REST
REST Misc
RSA Encryption
SCP
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
SharePoint
Socket/SSL/TLS
Spider
Stream
Tar Archive
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl

 

 

 

(DataFlex) Punycode Encoding / Decoding

Punycode is an encoding standard for representing Unicode characters using only the 7bit us-ascii characters that are permitted in network host names. Punycode is used for internationalized domain names -- i.e. IDN or IDNA (Internationalizing Domain Names in Applications).

Punycode is defined in RFC 3492. Converting to/from punycode does not include the "xn--" prefix. The "xn--" prefix is to signify that punycode follows. For example, the string " café.com" is converted to "caf-dma.com" in punycode. The punycode domain name is "xn--caf-dma.com".

Converting an email address to punycode would be as follows. Suppose the email address is "coffee@café.com". The punycode representation is "coffee@xn--caf-dma.com". The RFC 3492 punycode representation of "café.com" is simply "caf-dma.com", but the punycode domain name is "xn--caf-dma.com".

The "xn--" is a constant. It is the same regardless of the domain. For example, the punycode URL representation of "mañana.com" is "xn--maana-pta.com".

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoS
    String sTemp1

    Get Create (RefClass(cComCkString)) To hoS
    If (Not(IsComObjectCreated(hoS))) Begin
        Send CreateComObject of hoS
    End

    Send ComAppend To s "café"
    Send ComPunyEncode To s
    Get ComStr Of s To sTemp1
    Showln sTemp1

    Send ComPrepend To s "xn--"
    Send ComAppend To s ".com"
    Get ComStr Of s To sTemp1
    Showln sTemp1

    Send ComReplaceFirst To s "xn--" ""
    Send ComReplaceFirst To s ".com" ""
    Send ComPunyDecode To s
    Get ComStr Of s To sTemp1
    Showln sTemp1

    //  The output is:
    // 
    //  	caf-dma
    //  	xn--caf-dma.com
    //  	café
    // 


End_Procedure

 

© 2000-2019 Chilkat Software, Inc. All Rights Reserved.