Home | History | Annotate | Download | only in Lib

Lines Matching refs:encoding

349 def _replace_encoding(code, encoding):
354 # Convert the encoding to a C lib compatible encoding string
355 norm_encoding = encodings.normalize_encoding(encoding)
356 #print('norm encoding: %r' % norm_encoding)
359 #print('aliased encoding: %r' % norm_encoding)
360 encoding = locale_encoding_alias.get(norm_encoding,
362 #print('found encoding %r' % encoding)
363 return langname + '.' + encoding
376 If the given encoding is not known, the function defaults to
377 the default encoding for the locale code just like setlocale()
381 # Normalize the locale name and extract the encoding and modifier
386 # ':' is sometimes used as encoding delimiter.
393 langname, encoding = code.split('.')[:2]
396 encoding = ''
398 # First lookup: fullname (possibly with encoding and modifier)
400 if encoding:
401 norm_encoding = encoding.replace('-', '')
413 # Second try: fullname without modifier (possibly with encoding)
423 if encoding:
424 # Third try: langname (without encoding, possibly with modifier)
430 #print('lookup without encoding succeeded')
432 return _replace_encoding(code, encoding)
434 return _replace_encoding(code, encoding) + '@' + modifier
437 # Fourth try: langname (without encoding and modifier)
440 #print('lookup without modifier and encoding succeeded')
442 return _replace_encoding(code, encoding) + '@' + modifier
445 return _replace_encoding(code, encoding) + '@' + defmod
452 result as tuple (language code, encoding).
458 The language code corresponds to RFC 1766. code and encoding
482 encoding).
487 language, encoding = localetuple
490 if encoding is None:
493 return language + '.' + encoding
498 them as tuple (language code, encoding).
514 1766. code and encoding can be None in case the values cannot
522 code, encoding = _locale._getdefaultlocale()
526 # make sure the code/encoding values are valid
532 return code, encoding
551 tuple (language code, encoding).
557 1766. code and encoding can be None in case the values cannot
569 a string, an iterable of two strings (language code and encoding),
629 # comes with X11 and then hand edited removing the explicit encoding
635 # The local_encoding_alias table maps lowercase encoding alias names
636 # to C locale encoding names (case-sensitive). Note that normalize()
637 # first looks up the encoding in the encodings.aliases dictionary and
639 # encoding.
643 # Mappings for non-standard encoding names used in locale names
651 # Mappings from Python codec names to C lib encoding names
685 # language name is needed to interpret the given encoding alias
689 # removes '_' and '-' characters from the encoding part of the
2008 print 'Encoding: ', enc or '(undefined)'
2017 print ' Encoding: ', enc or '(undefined)'
2028 print ' Encoding: ', enc or '(undefined)'
2045 print ' Encoding: ', enc or '(undefined)'