Code Monkey home page Code Monkey logo

Comments (4)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 16, 2024
As UTF-8 is just an extension of ASCII, inih should handle UTF-8 just fine -- 
and in my tests, it does. I tested examples/ini_dump with the attached file, 
which contains those Chinese characters you included above, and it parses and 
dumps it without any problems.

So I think something else is going on here -- either your code handler function 
is doing something odd, or perhaps the file you've got isn't actually encoded 
as UTF-8?

Could you please attach the .ini file you're dealing with, as well as the code 
that's causing it to crash. If possible, please narrow it down to a small 
test-case that reproduces the problem. Also, please let me know what's the 
exact error/exception you're seeing -- is it a core dump?

Original comment by [email protected] on 4 Jan 2013 at 8:53

Attachments:

from inih.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 16, 2024
Thanks a lot for prompt response. 

I am getting same issue even with the file you attached.

issue is with isspace function, used in find_char_or_comment(). 
isspace() function is being used for every character(byte). When 
"Stock淨值查詢" string is being tested, till letter 'k' is fine but next 
utf-8 charcter is spread in 3 bytes. Hex of First character of 3 byte char 
sequence is e6, which is negative value if seen as individual byte.

When you perform test, what was your system locale. My endpoint is Win7, 64 bit 
machine. Initially image was English but i manually changed it to 
Chinese(simplified) locale. 

I have attached error snapshot while running in debug mode. 

Let me know if any more info needed. 

Note: In code, i nowhere see handling of such character which may be longer 
than 1 byte.


Original comment by [email protected] on 5 Jan 2013 at 6:10

Attachments:

from inih.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 16, 2024
Ah, very helpful -- thanks. I figured out this is caused by MSVC's default char 
type of "signed char" (most other compilers default to unsigned char, I think). 
And when compiling against the debug libraries with "cl /MDd", you get this 
assertion error. You can hack around it by also compiling with the /J flag 
(default char type of unsigned char), but I fixed this in the code as well, in 
r27, and uploaded a new zip file for version r27.

See also:

http://msdn.microsoft.com/en-us/library/ms245348.aspx

https://www.securecoding.cert.org/confluence/display/seccode/STR37-C.+Arguments+
to+character+handling+functions+must+be+representable+as+an+unsigned+char

Original comment by [email protected] on 6 Jan 2013 at 8:42

from inih.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 16, 2024
Fixed and tested with r27, closing.

Original comment by [email protected] on 6 Jan 2013 at 8:43

  • Changed state: Verified

from inih.

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.