| 1026 | public: |
| 1027 | PercentEncodeStream(OutputStream& os) : os_(os) {} |
| 1028 | void Put(char c) { // UTF-8 must be byte |
| 1029 | unsigned char u = static_cast<unsigned char>(c); |
| 1030 | static const char hexDigits[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; |
| 1031 | os_.Put('%'); |
| 1032 | os_.Put(hexDigits[u >> 4]); |
| 1033 | os_.Put(hexDigits[u & 15]); |
| 1034 | } |
| 1035 | private: |
| 1036 | OutputStream& os_; |
| 1037 | }; |