utf16BE encodes s as UTF-16 big-endian with a BOM.
(s string)
| 160 | |
| 161 | // utf16BE encodes s as UTF-16 big-endian with a BOM. |
| 162 | func utf16BE(s string) []byte { |
| 163 | out := make([]byte, 0, 2+2*len(s)) |
| 164 | out = append(out, 0xFE, 0xFF) // BE BOM |
| 165 | for _, r := range s { |
| 166 | out = append(out, byte(r>>8), byte(r)) |
| 167 | } |
| 168 | return out |
| 169 | } |