Code Monkey home page Code Monkey logo

Comments (10)

omegastripes avatar omegastripes commented on August 13, 2024

Could you please provide a minimal VBA code that can be used to reproduce the problem?

from vba-json-parser.

doom189 avatar doom189 commented on August 13, 2024

需要使用Win7测试才能重现问题
最小代码.zip

from vba-json-parser.

omegastripes avatar omegastripes commented on August 13, 2024

Seems there are some known encoding issues with the code, could you please rewrite it using ASCII charset only?

encoding error

from vba-json-parser.

doom189 avatar doom189 commented on August 13, 2024

非常抱歉, 那么晚才来更新问题, 请您谅解.
回复: 似乎代码中存在一些已知的编码问题,您能否仅使用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.

doom189 avatar doom189 commented on August 13, 2024

SimpleCodeASCII.zip
已去除中文注释, 应该不会有问题了

from vba-json-parser.

omegastripes avatar omegastripes commented on August 13, 2024

@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).
VBE

from vba-json-parser.

omegastripes avatar omegastripes commented on August 13, 2024

@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:
fix missing integer part zero

from vba-json-parser.

doom189 avatar doom189 commented on August 13, 2024

@omegastripes 好的大佬, 已经解决了, 您真的是Six Six Six
PS: 该问题是因为Windows7简体中文版的系统本身的日期时间还有数据格式设定问题导致的, 需要进系统修改数据格式才能正常使用(如图), 如果加入该代码, 就可以不进去系统设定, 也可以不修改正则把字符替换成文本了
image

from vba-json-parser.

omegastripes avatar omegastripes commented on August 13, 2024

@doom189 Could you please confirm that the problem is solved, and I can close the issue?

from vba-json-parser.

doom189 avatar doom189 commented on August 13, 2024

@omegastripes 已解决, 谢谢您!

from vba-json-parser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.