+ Reply to Thread
Results 1 to 2 of 2

Thread: Error displaying IDN on query results..

  1. Join Date
    Jun 2006
    Posts
    1

    Error displaying IDN on query results..

    Hi!

    First thanks for the script! it is great! ; )

    Though i have a newbie question, i m testing the whois on an idn domain www.??.net ( punycode: www.XN--WGV71A.NET ) but what i got an error regarding the display of the name correctly in unicode on the results next to the punycode string. This is what i got:
    Domain Name: XN--WGV71A.NET (ìíÜâ.net)

    I wonder whether the error is on my side? should i add UTF-8 to some pages?
    This is the image of the error

    http://img147.imageshack.us/my.php?i...icture41xk.png

    and thanks again! ; ) you save my day with this script!

  2. Join Date
    Aug 2004
    Posts
    781

    Re: Error displaying IDN on query results..

    I wonder whether the error is on my side? should i add UTF-8 to some pages?
    Long answer:
    By default the script adds correct UTF-8 encoding if (and only if) the headers have not been sent (no headers / output to browser).

    You must be including the whois script within another script because the whois script (by default) when IDN is enabled will attempt to add the correct UTF-8 encoding via PHP with:
    PHP Code:
    header("Content-Type: text/html; charset=UTF-8"); 
    The script also correctly adds this header with the include header / footer options found in the admin panel. Thus, you must be including this script within another script (which I do not necessarily recommend).

    Now on a separate subject: Since you are apparently including the script into a separate page rather than access whois.php directly (and using header / footer includes in admin panel), you will need to make some manual adjustments to the global.php file in the EP_Dev_Whois_Error class.

    _________________________________________________
    If you have PHP 4, you will need to:
    Find:
    PHP Code:
    $trigger_error false
    And change it to:
    PHP Code:
    $trigger_error true
    You will then need to implement your own error handler with set_error_handler() function of PHP.

    _________________________________________________
    If you have PHP 5, you will need to:
    Find:
    PHP Code:
    $throw_exception false
    And change it to:
    PHP Code:
    $throw_exception true
    Find:
    PHP Code:
    //throw new Exception("ep_dev_whois__error"); 
    And change it to:
    PHP Code:
    throw new Exception("ep_dev_whois__error"); 
    And then when including the file:
    PHP Code:
    try
    {
       include(
    "/absolute/path/to/whois.php");
    }
    catch (
    Exception $e)
    {
      
    // do nothing

    _________________________________________________

    Without the above modifications, the script will cut off output of errors when you are including the script in other files. This is why it is highly recommended that you instead use either the admin panel's built in template boxes or utilize the include header / footer file options in the admin panel. Both of those options will allow errors to gracefully exit (and your page will not be cut off). If you have no idea what I am talking about, just force an error (for example, a bad domain name or bad length) and then view the HTML of your page... you will notice everything after error statement is missing.

    Short answer:
    Yes, you do need to add UTF-8 header to whois pages.

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts