Closed aliva closed 11 years ago
روش فعلی حدس انکودینگ فایل خطا دارد باید از روش بهتری استفاده شود
درجه خطا پایین است، تا به حال فقط یک گزارش خط داشتم
الان از این دو قسمت استفاده میشود
def is_utf8(self): assert isinstance(self.string, str), repr(self.string) if isinstance(self.string, unicode): return True try: self.string.decode('utf8', 'strict') except UnicodeError: return True return False
if self.is_utf8(): self.string = self.string.decode('windows-1256') else: self.string = self.string.decode('utf-8')
به نظر میرسد فایلهایی که مشکل داشتند از انکودینگ utf-16 استفاده میکردند.
مشکل برای فالهایی که تست میکردم حل شد
روش فعلی حدس انکودینگ فایل خطا دارد باید از روش بهتری استفاده شود
درجه خطا پایین است، تا به حال فقط یک گزارش خط داشتم
الان از این دو قسمت استفاده میشود