mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-21 10:06:05 +02:00
Universal Acceptance Update (3/3)
This commit is contained in:
parent
f60b59b00b
commit
be965db4cc
5 changed files with 78 additions and 38 deletions
|
@ -576,4 +576,14 @@ function validateUniversalEmail($email) {
|
|||
|
||||
// Validate using regex
|
||||
return preg_match($emailPattern, $emailToValidate);
|
||||
}
|
||||
|
||||
function toPunycode($value) {
|
||||
// Convert to Punycode if it contains non-ASCII characters
|
||||
return preg_match('/[^\x00-\x7F]/', $value) ? idn_to_ascii($value, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46) : $value;
|
||||
}
|
||||
|
||||
function toUnicode($value) {
|
||||
// Convert from Punycode to UTF-8 if it's a valid IDN format
|
||||
return (strpos($value, 'xn--') === 0) ? idn_to_utf8($value, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46) : $value;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue