fork download
  1. from collections import Counter
  2.  
  3. count = Counter()
  4. for b in range(128, 256):
  5. string = chr(b)
  6. mojibake = [bytes([b])]
  7. for round in range(16):
  8. try:
  9. string = bytes(string, 'utf-8').decode('cp1252')
  10. except (UnicodeEncodeError, UnicodeDecodeError):
  11. break
  12. mojibake.append(string)
  13. count[",".join(str(len(x)) for x in mojibake)] += 1
  14.  
  15. for sig in sorted(count.keys()):
  16. print(count[sig], sig)
Success #stdin #stdout 0.3s 11908KB
stdin
Standard input is empty
stdout
10 1
2 1,2
1 1,2,4,10,23,50,110,245,546,1216,2708,6029,13420,29872,66497,148030,329532
1 1,2,4,10,23,51,113,252,561,1249,2781,6192,13784,30684,68305,152054,338488
2 1,2,4,10,24,53,116,257,572,1274,2838,6320,14069,31316,69709,155178,345444
37 1,2,4,8,18,42,95,211,468,1040,2314,5152,11472,25541,56857,126566,281744
1 1,2,4,8,19,45,102,226,501,1113,2477,5516,12284,27349,60881,135522,301680
37 1,2,4,9,20,44,98,219,488,1086,2417,5380,11976,26660,59349,132118,294108
1 1,2,4,9,21,47,105,234,521,1159,2580,5744,12788,28468,63373,141074,314044
1 1,2,4,9,21,48,107,237,526,1170,2605,5801,12916,28753,64005,142478,317168
1 1,2,4,9,21,49,110,244,541,1203,2678,5964,13280,29565,65813,146502,326124
2 1,2,4,9,22,51,113,249,552,1228,2735,6092,13565,30197,67217,149626,333080
2 1,2,5
11 1,2,5,11,24,54,121,269,598,1331,2963,6596,14684,32689,72769,161990,360605
1 1,2,5,11,24,55,124,276,613,1364,3036,6759,15048,33501,74577,166014,369561
1 1,2,5,11,25,57,128,284,631,1404,3126,6960,15496,34497,76793,170946,380541
11 1,2,5,12,26,56,124,277,618,1377,3066,6824,15188,33808,75261,167542,372969
1 1,2,5,12,26,57,127,284,633,1410,3139,6987,15552,34620,77069,171566,381925
1 1,2,5,12,27,59,131,292,651,1450,3229,7188,16000,35616,79285,176498,392905
1 1,2,5,12,27,60,133,295,656,1461,3254,7245,16128,35901,79917,177902,396029
1 1,2,5,12,27,61,136,302,671,1494,3327,7408,16492,36713,81725,181926,404985
1 1,2,5,13,29,62,136,303,676,1507,3357,7473,16632,37020,82409,183454,408393
1 1,2,5,13,29,63,139,310,691,1540,3430,7636,16996,37832,84217,187478,417349