Fix #2061 (Defective utf-16 txt files)
This commit is contained in:
		
							parent
							
								
									42ef049b63
								
							
						
					
					
						commit
						efb04ddd8f
					
				| 
						 | 
					@ -1420,7 +1420,7 @@ def serve_book(book_id, book_format, anyname):
 | 
				
			||||||
                               "rb").read()
 | 
					                               "rb").read()
 | 
				
			||||||
                result = chardet.detect(rawdata)
 | 
					                result = chardet.detect(rawdata)
 | 
				
			||||||
                return make_response(
 | 
					                return make_response(
 | 
				
			||||||
                    rawdata.decode(result['encoding']).encode('utf-8'))
 | 
					                    rawdata.decode(result['encoding'], 'surrogatepass').encode('utf-8', 'surrogatepass'))
 | 
				
			||||||
            except FileNotFoundError:
 | 
					            except FileNotFoundError:
 | 
				
			||||||
                log.error("File Not Found")
 | 
					                log.error("File Not Found")
 | 
				
			||||||
                return "File Not Found"
 | 
					                return "File Not Found"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user