Comments (7)
Hi,
Please, test the "main" branch for decimal separator awareness and other fixes. See InternalFloatToStr and InternalStrToFloat.
The "Shorteners" branch will be merged to "main" soon.
Regards,
from mcjson.
I thought the shortener was a newer version. The trunk version with "," or "." only 1 test failed (save and load using files).
from mcjson.
Nice.
Could you debug it and report why this test failed?
Here I have two Windows PCs with Lazarus 2.2.0 and 2.3.0 and both have zero failures.
from mcjson.
Hi, yes.
If any of them allowed then reasult test failed:
// load a Ansi file (especifying it)
M.LoadFromFile('test13-Ansi.json', false);
Result := Result and (M['ansi'].AsString = 'ăçüö');
// load a UTF-8 file
M.LoadFromFile('test13-UTF8.json');
Result := Result and (M['utf8'].AsString = 'ăçüö');
But not a surprise, as I see {$mode delphi} , and {$codepage cp1252} on the file header.
If I see these file with notepad++
-
test13-Ansi.json (force cp1252 codepage because I see garbage otherwise):
{"ansi":"ãçüö"} (it's different as you see) -
test13-UTF8.json (auto UTF8 detected correctly):
{"utf8":"ãçüö"} (it's different too as you see)
Then I try to rewrite the "ă" to "ã" in the source, then I got message from the Lazarus: "save file cp1250 loose characters.."
So this is character encoding problem.
from mcjson.
Hi,
-
"test13-Ansi.json" is a ANSI file with CP-1252 characters. Here in my Notepad++ (via menu Encoding > Character sets > Western European > Windows-1252) I can see "{"ansi":"ãçüö"}" as expected.
-
I've set {$codepage cp1252} in PrjTestMcJSON.lpr because the .lpr file is not encoded in UTF-8. It opens correctly, it compiles and run OK.
-
Into your description I just see "ãçüö". There is no "ă" (items 1 and 2).
I think this error is related with your Windows (System) Codepage, that might be different from 1252. I just don't know why {$codepage cp1252} failed in order to prevent this CodePage misleading.
I'll explore changing my source code files to UTF-8, but I think this will broke Delphi (old versions) and Lazarus/FPC compatibility. I'll try changing just the .lpr file first to UTF-8 and improve Test13.
On the other hand, I think this error can't stop you from using McJSON if you work with .json files encoded in UTF-8.
Thanks for sharing. Stay tuned to next commits.
Regards,
from mcjson.
Hi, I stayed, with the latest revision 94, the result of test 13 is still failed (Laz 2.2.4 and Laz 2.3.0 both same results)
from mcjson.
Hi,
I was revising Lazarus support to UTF-8, comparing it to Delphi pre-Unicode, and I think it is expected that Test13
fails with a Windows CodePage different from 1252.
I'll close this thread because it is in the wrong branch.
Please, create a new Issue within main
branch and report your Windows CodePage.
Regards,
from mcjson.
Related Issues (20)
- Invalid char at pos 1 (UTF8 BOM support) HOT 6
- Excepted got "/" (Comment support) HOT 11
- Unknown escape at pos (escpaing support) HOT 15
- McJsonEscapeString (overzealous) HOT 17
- Slow json generation speed HOT 5
- MCJsonUnEscapeString "/" and "\" missing after unescape HOT 3
- HasKey exception HOT 11
- New empty key destroys the json structure HOT 10
- Check function does not return the wrong position HOT 7
- Check function speed problem HOT 10
- Slower shortener operation (but I realized this is normal because of the AddOrSet search) HOT 7
- McJSONEscapeString TAB problem HOT 3
- How check path exist by not throw error HOT 9
- How fix warning compiler about string HOT 5
- how to get int64 value ? HOT 2
- When value is a json string, tostring does not handle escaping HOT 5
- Range check error HOT 9
- PrjTestMcJSON - many exception HOT 5
- Test #13 failed in Main branch (trunk rev. #94) HOT 4
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 mcjson.