path = 'c:/NeoZQYY/docs/h5_ui/compare/AGENT-PLAYBOOK.md' with open(path, 'rb') as f: raw = f.read() content = raw.decode('utf-8') # Fix all remaining instances of wrong characters content = content.replace('\u9501\u70b9\u6cd5', '\u9501\u70b9\u6cd5'.replace('\u9501', '\u9576')) # won't work this way # Direct string replacements content = content.replace('\u5207\u6362\u5230\u9501\u70b9\u6cd5', '\u5207\u6362\u5230\u9501\u70b9\u6cd5') # Just replace all occurrences of the wrong chars import re # \u9501 = 锁, \u9576 = 锚 content = content.replace('\u9501\u70b9', '\u9576\u70b9') with open(path, 'wb') as f: f.write(content.encode('utf-8')) # Verify count = content.count('\u9576\u70b9') # 锚点 remaining = content.count('\u9501\u70b9') # 锁点 print('锚点 count:', count, '| 锁点 remaining:', remaining)