MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _replace_encoding

Function _replace_encoding

tools/python-3.11.9-amd64/Lib/locale.py:362–383  ·  view source on GitHub ↗
(code, encoding)

Source from the content-addressed store, hash-verified

360_setlocale = setlocale
361
362def _replace_encoding(code, encoding):
363 if '.' in code:
364 langname = code[:code.index('.')]
365 else:
366 langname = code
367 # Convert the encoding to a C lib compatible encoding string
368 norm_encoding = encodings.normalize_encoding(encoding)
369 #print('norm encoding: %r' % norm_encoding)
370 norm_encoding = encodings.aliases.aliases.get(norm_encoding.lower(),
371 norm_encoding)
372 #print('aliased encoding: %r' % norm_encoding)
373 encoding = norm_encoding
374 norm_encoding = norm_encoding.lower()
375 if norm_encoding in locale_encoding_alias:
376 encoding = locale_encoding_alias[norm_encoding]
377 else:
378 norm_encoding = norm_encoding.replace('_', '')
379 norm_encoding = norm_encoding.replace('-', '')
380 if norm_encoding in locale_encoding_alias:
381 encoding = locale_encoding_alias[norm_encoding]
382 #print('found encoding %r' % encoding)
383 return langname + '.' + encoding
384
385def _append_modifier(code, modifier):
386 if modifier == 'euro':

Callers 2

_append_modifierFunction · 0.85
normalizeFunction · 0.85

Calls 4

indexMethod · 0.45
getMethod · 0.45
lowerMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected