Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pikelang
pike
Commits
576e4229
Commit
576e4229
authored
Mar 31, 2003
by
Marcus Comstedt
Browse files
Options
Downloads
Patches
Plain Diff
This should be more according to the standard...
Rev: lib/modules/Standards.pmod/IDNA.pmod:1.5
parent
e01fa4ee
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/modules/Standards.pmod/IDNA.pmod
+9
-6
9 additions, 6 deletions
lib/modules/Standards.pmod/IDNA.pmod
with
9 additions
and
6 deletions
lib/modules/Standards.pmod/IDNA.pmod
+
9
−
6
View file @
576e4229
...
@@ -380,8 +380,10 @@ string to_ascii(string s, int(0..1)|void allow_unassigned,
...
@@ -380,8 +380,10 @@ string to_ascii(string s, int(0..1)|void allow_unassigned,
int(0..1)|void use_std3_ascii_rules)
int(0..1)|void use_std3_ascii_rules)
{
{
int is_ascii = max(@values(s)) < 128;
int is_ascii = max(@values(s)) < 128;
if(!is_ascii)
if(!is_ascii)
{
s = nameprep(s, allow_unassigned);
s = nameprep(s, allow_unassigned);
is_ascii = max(@values(s)) < 128;
}
if(use_std3_ascii_rules) {
if(use_std3_ascii_rules) {
if(array_sscanf(s, "%*[^\0-,./:-@[-`{-\x7f]%n")[0] != sizeof(s))
if(array_sscanf(s, "%*[^\0-,./:-@[-`{-\x7f]%n")[0] != sizeof(s))
error("Label is not valid accoring to STD3: non-LDH codepoint\n");
error("Label is not valid accoring to STD3: non-LDH codepoint\n");
...
@@ -409,18 +411,19 @@ string to_ascii(string s, int(0..1)|void allow_unassigned,
...
@@ -409,18 +411,19 @@ string to_ascii(string s, int(0..1)|void allow_unassigned,
//! The sequence of Unicode code points to transform.
//! The sequence of Unicode code points to transform.
string to_unicode(string s)
string to_unicode(string s)
{
{
string s0 = s;
if(max(@values(s)) >= 128 &&
if(max(@values(s)) >= 128 &&
catch(s = nameprep(s, 1)))
catch(s = nameprep(s, 1)))
return s;
return s
0
;
if(lower_case(s[..3]) != "xn--")
if(lower_case(s[..3]) != "xn--")
return s;
return s
0
;
string
orig
_s = s;
string
ascii
_s = s;
catch {
catch {
s = Punycode->decode(s[4..]);
s = Punycode->decode(s[4..]);
if(lower_case(to_ascii(s, 1)) == lower_case(
orig
_s))
if(lower_case(to_ascii(s, 1)) == lower_case(
ascii
_s))
return s;
return s;
};
};
return
orig_
s;
return s
0
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment