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

View File

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