Comments (10)
Could you please provide a minimal VBA code that can be used to reproduce the problem?
from vba-json-parser.
需要使用Win7测试才能重现问题
最小代码.zip
from vba-json-parser.
Seems there are some known encoding issues with the code, could you please rewrite it using ASCII charset only?
from vba-json-parser.
非常抱歉, 那么晚才来更新问题, 请您谅解.
回复: 似乎代码中存在一些已知的编码问题,您能否仅使用ASCII字符集重写它?
答: 因为我用的是中文简体的Windows, 使用的Office2010中文简体, 可能导致.xlsm文件在非中文系统上出现乱码.(乱码的都是中文)
回归到该问题本身, 我通过Regex正则处理后已经可以在Windows7上正常使用了(但是不是存为数值了, 而是存为文本)
' RegExStr函数(被处理文本, 正则表达式, True替换_默认为False, 被替换值_True时必填)
YL = RegExStr(Range("K10").Value, "\d+(?:.\d+)?|.\d+") ' 用量, 获得数值部分 (文本类型)
YL = RegExStr(YL, "^.", True, "0.") ' 用量, 替换开头是.001的为"0.001" (文本类型)
JSONOBJ("KangChenDianFen")("YongLiang") = YL ' 抗沉淀粉的用量=用量
最小代码.txt
from vba-json-parser.
SimpleCodeASCII.zip
已去除中文注释, 应该不会有问题了
from vba-json-parser.
@doom189 Sorry, still have no idea how to reproduce the issue you described. The numbers serialized with JSON.Serialize
method is valid for me (Win7 HB x64 ru, MS Office 2010 x64 En).
from vba-json-parser.
@doom189 Anyway, you may try to fix the issue with fix missing integer part zero: add the line If Left(.Item(.Count - 1), 1) = "." Then .Item(.Count - 1) = "0" & .Item(.Count - 1)
right after the line .Item(.Count) = Replace(vElement, ",", ".")
in JSON
module:
from vba-json-parser.
@omegastripes 好的大佬, 已经解决了, 您真的是Six Six Six
PS: 该问题是因为Windows7简体中文版的系统本身的日期时间还有数据格式设定问题导致的, 需要进系统修改数据格式才能正常使用(如图), 如果加入该代码, 就可以不进去系统设定, 也可以不修改正则把字符替换成文本了
from vba-json-parser.
@doom189 Could you please confirm that the problem is solved, and I can close the issue?
from vba-json-parser.
@omegastripes 已解决, 谢谢您!
from vba-json-parser.
Related Issues (20)
- Type mismatch HOT 4
- Dictionary Key is not escaped during serialization
- Won't run after import HOT 1
- Change all Dictionary references to specify Scripting.Dictionary HOT 4
- Parser is failing to handle a JSON containing git issues HOT 2
- Escaped characters in a string HOT 2
- Make SerializeElement work with range().value output multidimensional array HOT 2
- parser become very slow HOT 3
- selectElement() bug with certain paths HOT 3
- Invalid JSON response HOT 4
- I got stuck on the child list HOT 47
- there is a error aftering use 2 times HOT 3
- Type Mismatch for JSON format in a list/array HOT 2
- Data being trimmed / truncated ? HOT 2
- "Invalid use of New keyword" in json_ParseObject HOT 2
- Parsing escaped \ HOT 1
- How to use it with OpenOffice? HOT 1
- Does this work for anybody? HOT 8
- vJSON.Item is failing HOT 3
- camelCase
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 vba-json-parser.