diff options
Diffstat (limited to 'src/mono_opt.sml')
-rw-r--r-- | src/mono_opt.sml | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/mono_opt.sml b/src/mono_opt.sml index bf39b311..dd04a838 100644 --- a/src/mono_opt.sml +++ b/src/mono_opt.sml @@ -76,11 +76,19 @@ fun hexIt ch = | _ => s end -val urlifyString = String.translate (fn #" " => "+" - | ch => if Char.isAlphaNum ch then - str ch - else - "%" ^ hexIt ch) +fun urlifyString s = + case s of + "" => "_" + | _ => + (if String.sub (s, 0) = #"_" then + "_" + else + "") + ^ String.translate (fn #" " => "+" + | ch => if Char.isAlphaNum ch then + str ch + else + "%" ^ hexIt ch) s fun sqlifyInt n = #p_cast (Settings.currentDbms ()) (attrifyInt n, Settings.Int) |