Lines Matching +full:utf +full:- +full:8
4 * SPDX-License-Identifier: LGPL-2.1+
6 * Ported to U-Boot by: Thomas Smits <ts.smits@gmail.com> and
26 * BUT it currently rejects legit 4-byte UTF-8 code points, in utf8_to_utf16le()
32 * 2-byte sequence: in utf8_to_utf16le()
45 * 3-byte sequence (most CJKV characters): in utf8_to_utf16le()
68 * 4-byte sequence (surrogate pairs, currently rare): in utf8_to_utf16le()
80 len--; in utf8_to_utf16le()
84 return -1; in utf8_to_utf16le()
89 * usb_gadget_get_string - fill out a string descriptor
90 * @table: of c strings encoded using UTF-8
94 * Finds the UTF-8 string matching the ID, and converts it into a
95 * string descriptor in utf16-le.
100 * using this routine after choosing which set of UTF-8 strings to use.
101 * Note that US-ASCII is a strict subset of UTF-8; any string bytes with
102 * the eighth bit set will be multibyte UTF-8 characters, not ISO-8859/1
112 return -EINVAL; in usb_gadget_get_string()
118 buf[2] = (u8) table->language; in usb_gadget_get_string()
119 buf[3] = (u8) (table->language >> 8); in usb_gadget_get_string()
122 for (s = table->strings; s && s->s; s++) in usb_gadget_get_string()
123 if (s->id == id) in usb_gadget_get_string()
127 if (!s || !s->s) in usb_gadget_get_string()
128 return -EINVAL; in usb_gadget_get_string()
130 /* string descriptors have length, tag, then UTF16-LE text */ in usb_gadget_get_string()
131 len = min((size_t) 126, strlen(s->s)); in usb_gadget_get_string()
133 len = utf8_to_utf16le(s->s, (__le16 *)&buf[2], len); in usb_gadget_get_string()
135 return -EINVAL; in usb_gadget_get_string()