Rev 76 | Rev 143 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 76 | Rev 106 | ||
---|---|---|---|
Line 218... | Line 218... | ||
218 | return $randomString; |
218 | return $randomString; |
219 | } |
219 | } |
220 | 220 | ||
221 | # http://stackoverflow.com/a/9361531 |
221 | # http://stackoverflow.com/a/9361531 |
222 | function _uniord($c) { |
222 | function _uniord($c) { |
223 | if (ord($c{0}) >=0 && ord($c{0}) <= 127) |
223 | if (ord($c[0]) >=0 && ord($c[0]) <= 127) |
224 | return ord($c{0}); |
224 | return ord($c[0]); |
225 | if (ord($c{0}) >= 192 && ord($c{0}) <= 223) |
225 | if (ord($c[0]) >= 192 && ord($c[0]) <= 223) |
226 | return (ord($c{0})-192)*64 + (ord($c{1})-128); |
226 | return (ord($c[0])-192)*64 + (ord($c[1])-128); |
227 | if (ord($c{0}) >= 224 && ord($c{0}) <= 239) |
227 | if (ord($c[0]) >= 224 && ord($c[0]) <= 239) |
228 | return (ord($c{0})-224)*4096 + (ord($c{1})-128)*64 + (ord($c{2})-128); |
228 | return (ord($c[0])-224)*4096 + (ord($c[1])-128)*64 + (ord($c[2])-128); |
229 | if (ord($c{0}) >= 240 && ord($c{0}) <= 247) |
229 | if (ord($c[0]) >= 240 && ord($c[0]) <= 247) |
230 | return (ord($c{0})-240)*262144 + (ord($c{1})-128)*4096 + (ord($c{2})-128)*64 + (ord($c{3})-128); |
230 | return (ord($c[0])-240)*262144 + (ord($c[1])-128)*4096 + (ord($c[2])-128)*64 + (ord($c[3])-128); |
231 | if (ord($c{0}) >= 248 && ord($c{0}) <= 251) |
231 | if (ord($c[0]) >= 248 && ord($c[0]) <= 251) |
232 | return (ord($c{0})-248)*16777216 + (ord($c{1})-128)*262144 + (ord($c{2})-128)*4096 + (ord($c{3})-128)*64 + (ord($c{4})-128); |
232 | return (ord($c[0])-248)*16777216 + (ord($c[1])-128)*262144 + (ord($c[2])-128)*4096 + (ord($c[3])-128)*64 + (ord($c[4])-128); |
233 | if (ord($c{0}) >= 252 && ord($c{0}) <= 253) |
233 | if (ord($c[0]) >= 252 && ord($c[0]) <= 253) |
234 | return (ord($c{0})-252)*1073741824 + (ord($c{1})-128)*16777216 + (ord($c{2})-128)*262144 + (ord($c{3})-128)*4096 + (ord($c{4})-128)*64 + (ord($c{5})-128); |
234 | return (ord($c[0])-252)*1073741824 + (ord($c[1])-128)*16777216 + (ord($c[2])-128)*262144 + (ord($c[3])-128)*4096 + (ord($c[4])-128)*64 + (ord($c[5])-128); |
235 | if (ord($c{0}) >= 254 && ord($c{0}) <= 255) // error |
235 | if (ord($c[0]) >= 254 && ord($c[0]) <= 255) // error |
236 | return FALSE; |
236 | return FALSE; |
237 | return 0; |
237 | return 0; |
238 | } |
238 | } |
239 | 239 | ||
240 | # urn:OID:2.0999 -> .2.999 |
240 | # urn:OID:2.0999 -> .2.999 |