Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente | Révision précédente Dernière révision Les deux révisions suivantes | ||
scripts-python [2017/07/25 19:02] |
scripts-python [2023/06/11 13:19] pielo |
||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
+ | ====== Scripts Python ====== | ||
+ | ===== Corriger/ | ||
+ | |||
+ | Alternative sous MySQL/ | ||
+ | |||
+ | Lien : https:// | ||
+ | |||
+ | ```sql | ||
+ | select convert(binary convert(field_name using latin1) using utf8) from table_name | ||
+ | ``` | ||
+ | |||
+ | |||
+ | [[https:// | ||
+ | |||
+ | |||
+ | Installer pip et ftfy sous ubuntu | ||
+ | <code bash> | ||
+ | apt install python3-pip | ||
+ | pip3 install ftfy | ||
+ | </ | ||
+ | |||
+ | Corriger l' | ||
+ | <code python> | ||
+ | # | ||
+ | # coding: utf-8 | ||
+ | |||
+ | import ftfy | ||
+ | |||
+ | # Set input_file | ||
+ | input_file = open(' | ||
+ | # Set output file | ||
+ | output_file = open (' | ||
+ | |||
+ | # Create fixed output stream | ||
+ | stream = ftfy.fix_file( | ||
+ | input_file, | ||
+ | encoding=None, | ||
+ | fix_entities=' | ||
+ | remove_terminal_escapes=False, | ||
+ | fix_encoding=True, | ||
+ | fix_latin_ligatures=False, | ||
+ | fix_character_width=False, | ||
+ | uncurl_quotes=False, | ||
+ | fix_line_breaks=False, | ||
+ | fix_surrogates=False, | ||
+ | remove_control_chars=False, | ||
+ | remove_bom=False, | ||
+ | normalization=' | ||
+ | ) | ||
+ | |||
+ | # Save stream to output file | ||
+ | stream_iterator = iter(stream) | ||
+ | while stream_iterator: | ||
+ | try: | ||
+ | line = next(stream_iterator) | ||
+ | output_file.write(line) | ||
+ | except StopIteration: | ||
+ | break | ||
+ | </ |