text: public static string ToHexString(string s){var sb = new StringBuilder();for (int i = 0; i < s.Length; i++){char ch = s[i];if (i > 0){sb.Append(' ');}if (ch < 128){sb.Append(ch);}else{if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END){sb.Append("H:");}else if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END){sb.Append("L:");}else if (ch > UNI_SUR_LOW_END){if (ch == 0xffff){sb.Append("F:");}else{sb.Append("E:");}}sb.Append("0x" + ((short)ch).ToString("X"));}}return sb.ToString();}