Lines Matching refs:string
41 (?P<encoded>.*?) # non-greedy up to the next ?= is the encoded string
66 Returns a list of (string, charset) pairs containing each of the decoded
68 otherwise a lower-case string containing the name of the character set
69 specified in the encoded string.
71 header may be a string that may or may not contain RFC2047 encoded words,
79 return [(_charset._encode(string, str(charset)), str(charset))
80 for string, charset in header._chunks]
163 decode_header() takes a header value string and returns a sequence of
164 pairs of the format (decoded_string, charset) where charset is the string
191 method calls. s may be a byte string or a Unicode string, but see the
232 """Return the string value of the header."""
237 for string, charset in self._chunks:
242 # Don't add a space if the None/us-ascii string already has
246 original_bytes = string.encode('ascii', 'surrogateescape')
247 string = original_bytes.decode('ascii', 'replace')
249 hasspace = string and self._nonctext(string[0])
256 lastspace = string and self._nonctext(string[-1])
258 uchunks.append(string)
264 # other may be a Header or a string. Both are fine so coerce
270 """Append a string to the MIME header.
277 s may be a byte string or a Unicode string. If it is a byte string
279 that byte string, and a UnicodeError will be raised if the string
280 cannot be decoded with that charset. If s is a Unicode string, then
282 the string. In either case, when producing an RFC 2822 compliant
283 header using RFC 2047 rules, the string will be encoded using the
284 output codec of the charset. If the string cannot be encoded to the
288 call if s is a byte string.
313 """True if string s is not a ctext character of RFC822.
320 There are many issues involved in converting a given string for use in
329 line, exclusive of the linesep string. Individual lines may be longer
335 Optional splitchars is a string containing characters which should be
340 which they appear in the string. Space and tab may be included in the
341 string to indicate whether preference should be given to one over the
345 Optional linesep is a string to be used to separate the lines of
362 for string, charset in self._chunks:
364 hasspace = string and self._nonctext(string[0])
370 lastspace = string and self._nonctext(string[-1])
373 lines = string.splitlines()
399 # get collapsed into a single unicode string.
403 for string, charset in self._chunks:
405 last_chunk.append(string)
409 last_chunk = [string]
448 def feed(self, fws, string, charset):
455 self._ascii_split(fws, string, self._splitchars)
464 encoded_lines = charset.header_encode_lines(string, self._maxlengths())
491 def _ascii_split(self, fws, string, splitchars):
505 parts = re.split("(["+FWS+"]+)", fws+string)
513 def _append_chunk(self, fws, string):
514 self._current_line.push(fws, string)
552 def push(self, fws, string):
553 self.append((fws, string))