Return a string replacing by a space all null bytes. There are some rare cases where we can have binary strings that are not caught early when detecting a file type, but only late at the line level. This help catch most of these cases.
(s)
| 285 | |
| 286 | |
| 287 | def remove_null_bytes(s): |
| 288 | """ |
| 289 | Return a string replacing by a space all null bytes. |
| 290 | |
| 291 | There are some rare cases where we can have binary strings that are not |
| 292 | caught early when detecting a file type, but only late at the line level. |
| 293 | This help catch most of these cases. |
| 294 | """ |
| 295 | return s.replace('\x00', ' ') |
| 296 | |
| 297 | |
| 298 | def remove_verbatim_cr_lf_tab_chars(s): |