comparison src/mono_opt.sml @ 925:552c989c1601

Change string URLification to avoid using the empty string, which confuses Apache no2slash()
author Adam Chlipala <adamc@hcoop.net>
date Sat, 12 Sep 2009 09:31:50 -0400
parents 8e540df3294d
children ad434669f299
comparison
equal deleted inserted replaced
924:803342eb2dc0 925:552c989c1601
74 0 => "00" 74 0 => "00"
75 | 1 => "0" ^ s 75 | 1 => "0" ^ s
76 | _ => s 76 | _ => s
77 end 77 end
78 78
79 val urlifyString = String.translate (fn #" " => "+" 79 fun urlifyString s =
80 | ch => if Char.isAlphaNum ch then 80 case s of
81 str ch 81 "" => "_"
82 else 82 | _ =>
83 "%" ^ hexIt ch) 83 (if String.sub (s, 0) = #"_" then
84 "_"
85 else
86 "")
87 ^ String.translate (fn #" " => "+"
88 | ch => if Char.isAlphaNum ch then
89 str ch
90 else
91 "%" ^ hexIt ch) s
84 92
85 93
86 fun sqlifyInt n = #p_cast (Settings.currentDbms ()) (attrifyInt n, Settings.Int) 94 fun sqlifyInt n = #p_cast (Settings.currentDbms ()) (attrifyInt n, Settings.Int)
87 fun sqlifyFloat n = #p_cast (Settings.currentDbms ()) (attrifyFloat n, Settings.Float) 95 fun sqlifyFloat n = #p_cast (Settings.currentDbms ()) (attrifyFloat n, Settings.Float)
88 96