Lines Matching +full:utf +full:- +full:8
1 // SPDX-License-Identifier: LGPL-2.1+
19 * usb_gadget_get_string - fill out a string descriptor
20 * @table: of c strings encoded using UTF-8
22 * @buf: at least 256 bytes, must be 16-bit aligned
24 * Finds the UTF-8 string matching the ID, and converts it into a
25 * string descriptor in utf16-le.
30 * using this routine after choosing which set of UTF-8 strings to use.
31 * Note that US-ASCII is a strict subset of UTF-8; any string bytes with
32 * the eighth bit set will be multibyte UTF-8 characters, not ISO-8859/1
45 buf [2] = (u8) table->language; in usb_gadget_get_string()
46 buf [3] = (u8) (table->language >> 8); in usb_gadget_get_string()
49 for (s = table->strings; s && s->s; s++) in usb_gadget_get_string()
50 if (s->id == id) in usb_gadget_get_string()
54 if (!s || !s->s) in usb_gadget_get_string()
55 return -EINVAL; in usb_gadget_get_string()
57 /* string descriptors have length, tag, then UTF16-LE text */ in usb_gadget_get_string()
58 len = min((size_t)USB_MAX_STRING_LEN, strlen(s->s)); in usb_gadget_get_string()
59 len = utf8s_to_utf16s(s->s, len, UTF16_LITTLE_ENDIAN, in usb_gadget_get_string()
62 return -EINVAL; in usb_gadget_get_string()
70 * usb_validate_langid - validate usb language identifiers