View Full Version : Error displaying IDN on query results..
dominios
06-25-2006, 05:51 PM
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?image=picture41xk.png
and thanks again! ; ) you save my day with this script!
Patrick
06-25-2006, 06:39 PM
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:
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:
$trigger_error = false;
And change it to:
$trigger_error = true;
You will then need to implement your own error handler with set_error_handler() (http://www.php.net/manual/en/function.set-error-handler.php) function of PHP.
_________________________________________________
If you have PHP 5, you will need to:
Find:
$throw_exception = false;
And change it to:
$throw_exception = true;
Find:
//throw new Exception("ep_dev_whois__error");
And change it to:
throw new Exception("ep_dev_whois__error");
And then when including the file:
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.
Powered by vBulletin™ Version 4.0.0 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.