Comments (7)
utf-8 with bom
早该进历史垃圾堆了。。。不存在 windows 兼容性不好。vscode, clion, qtcreator 全都默认是 utf-8 no bom
,早就是事实上的标准了
from paddleocr-json.
其实本项目v1.1及以前的工程文件是UTF8编码的,会产生一个神奇bug:使用vs2019编译时,以中文结尾的注释有几率吞掉后一个换行符,导致下一行代码也被注释。这种现象只在编译时发生,写的时候vs编辑器并不会提示异常,导致难以发现。
每一个中文注释的句尾加多一个空格可避免此问题。不过为了防止某一天漏加空格导致玄学异常,我还是决定用回默认编码算了。当然,不用中文注释也能一劳永逸解决,只是我个人不习惯。
移植Linux的话,本项目为了兼容windows的不同语言区域,使用了很多win平台的API来处理文件路径。剪贴板相关的代码应该也是win api。移植Linux可能要重写 tools.cpp 中的大部分函数。
from paddleocr-json.
这种问题我遇到过,加上编译选项 /utf-8
,见 https://learn.microsoft.com/en-us/cpp/build/reference/utf-8-set-source-and-executable-character-sets-to-utf-8?view=msvc-160
一个汉字 UTF8 编码是3个字节,GBK 编码是2个字节。当恰好是奇数个汉字时,编译器当作 GBK 处理,这时就会吃掉后面一个换行符。
from paddleocr-json.
windows 下为了处理国际化不同语言编码问题,一般外部打印输出统一用 wstring
(所谓的宽字符,UTF-16编码),内部可以统一用 UTF-8。
from paddleocr-json.
一般外部打印输出统一用 wstring (所谓的宽字符,UTF-16编码),内部可以统一用 UTF-8
现在是内部 wstring 和 string 混用,因为兼容多语言区域的win api一般都是用宽字符参数,但json解析器的nlohmann库
使用 u8 string ,只好互相转换。
至于输出,因为某些Paddle和Opencv链接库的内部有日志输出,改不了那部分代码。考虑到 wcout 和 cout 混用可能出现问题,就全部cout了。
加上编译选项 /utf-8
好建议,有空试试。还有个问题请教一下,应该保存为 utf-8 with bom
还是 no bom
呢, with bom
可能Linux兼容性不太好,no bom
则win兼容性不太好?
from paddleocr-json.
能问一下这里面的模型是你自己训练的吗,还是从 PaddleOCR 官网下载的?
from paddleocr-json.
模型都是官方的,这里
from paddleocr-json.
Related Issues (20)
- config_path HOT 1
- 其他语言支持 HOT 1
- 能支持方向识别结果的输出嘛
- 字节流识别失败 错误信息:Base64 data imdecode failed. HOT 2
- 是否可以跳过文本检测模型 HOT 1
- 【致谢,被其他开源项目用到了】QT+Rust开发的paddleOCR桌面软件(示例) HOT 2
- 如果一张图片同时有中文/英文/日文,那么该如何选择模型呢? HOT 3
- 不知道能否增加GPU版本的支持 HOT 1
- 超长图片无法识别。 HOT 2
- MingW64 编译的C++项目,是不是不能嵌入本项目? HOT 2
- ocr.runBase64(base64Str)运行后无法获取正确结果
- ocr.runBase64(base64Str)运行后无法获取正确结果 HOT 2
- 能否增加表格识别的支持 HOT 1
- 无法使用PIL读取的图片进行识别,也无法使用字节流 HOT 1
- 无法使用ch_PP-OCRv4_rec_infer HOT 3
- 推理结果问题 HOT 4
- PaddleOCR-json.exe 文字识别很好用 能不能开放一个表格识别接口出来 HOT 1
- 使用python-api的依赖包 HOT 1
- 关于pyinstaller 封装exe的问题 HOT 3
- python调用,存在内存泄漏,跑了一天,内存增长到6G HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from paddleocr-json.