Cyrillic domain name

How can I get a page from the Internet if I have a Cyrillic domain (http: //president.rf/) with Delphi 7.

Thanks!

+7
delphi
source share
1 answer

I wrote a punycode encoder / decoder available here:

http://code.google.com/p/delphionrails/source/browse/trunk/src/dorPunyCode.pas

using:

function PEncode(const str: UnicodeString): AnsiString; var len: Cardinal; begin Result := ''; if (PunycodeEncode(Length(str), PPunyCode(str), len) = pcSuccess) and (Length(str) + 1 <> len) then begin SetLength(Result, len); PunycodeEncode(Length(str), PPunyCode(str), len, PByte(Result)); Result := 'xn--' + Result; end else Result := AnsiString(str); end; Format('http://%s.%s', [PEncode(''), PEncode('')]); 
+10
source share

All Articles