changed to use | instead of : in hex-ascii conversion

This commit is contained in:
hyung-hwan 2015-03-17 06:48:16 +00:00
parent 5e58b3eda2
commit 2702b84b81
3 changed files with 15 additions and 13 deletions

View File

@ -151,7 +151,7 @@ $config['subclass_prefix'] = 'MY_';
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_@\-!*';
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_@\-!*|';
/*

View File

@ -26,17 +26,19 @@ class Converter
// backslash to double backslashes.
$seg = '!!';
}
else if ($ascii[$i] == ':')
else if ($ascii[$i] == '|')
{
// colon to backslash-colon
$seg = '!:';
$seg = '!|';
}
else if ($ascii[$i] == '/')
{
// slash to colon
$seg = ':';
$seg = '|';
}
else if ($ascii[$i] == '.' || $ascii[$i] == '_' || $ascii[$i] == '-' || $ascii[$i] == ' ')
else if ($ascii[$i] == '.' || $ascii[$i] == '_' ||
$ascii[$i] == '-' || $ascii[$i] == ':' ||
$ascii[$i] == '@' || $ascii[$i] == ' ')
{
// no conversion for a period, an underscore, a dash, and a space
$seg = $ascii[$i];
@ -94,7 +96,7 @@ class Converter
$seg = $hex[$i];
}
}
else if ($hex[$i] == ':')
else if ($hex[$i] == '|')
{
// colon to slash
$seg = '/';

View File

@ -197,7 +197,7 @@ var asciiToHex = function (x,dir) {
{
var i;
/*
for(i = 0; i < x.length; i++)
for(i=0; i<x.length; i++)
{
var tmp = x.charCodeAt(i).toString(16);
if (tmp.length == 1) r += "0";
@ -214,21 +214,22 @@ var asciiToHex = function (x,dir) {
{
seg = "!!";
}
else if (c == ":")
else if (c == "|")
{
seg = "!:";
seg = "!|";
}
else if (c == "/")
{
seg = ":";
seg = "|";
}
else if (c == "." || c == "_" || c == "-" || c == " ")
else if (c == "." || c == "_" || c == "-" ||
c == ":" || c == "@" || c == " ")
{
seg = c;
}
else
{
if (/^[A-Za-z0-9]$/.test(c))
if (/^[A-Za-z0-9]$/.test (c))
{
seg = c;
}
@ -241,7 +242,6 @@ var asciiToHex = function (x,dir) {
r += seg;
}
}
else
{