Code Monkey home page Code Monkey logo

Comments (5)

SoftCircuits avatar SoftCircuits commented on June 21, 2024

There is no option for this. I have never seen quotes be part of the INI file standard. Unlike with CSV files, I don't see why they would be necessary. Who is writing INI files that way?

If you can show me where this is standard, I'll consider adding support for it.

Meanwhile, you can remove those quotes using value = value.Trim('"').

from inifileparser.

lmattcris avatar lmattcris commented on June 21, 2024

Well, the INI files format is indeed a loose one. I've been using for a long time the GetPrivateProfileString API call, from Win32, and I had to replicate it in different environments. It uses both single and double quotes escaping in values.
https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getprivateprofilestringw
It's also mentioned on Wikipedia as well (as shown in an example too)
https://en.wikipedia.org/wiki/INI_file#Comparison_of_INI_parsers

I think that sometimes it can be a help in reading complex assignments, like
MyHideouslyLongNameKey = "= This is going to be cleaner than without blanks around ="

Just a welcome feature, not an issue - sorry if I used the "issue" space on GitHub! 😺

from inifileparser.

SoftCircuits avatar SoftCircuits commented on June 21, 2024

So, your first link talks about supporting quotes around the key.

[Section]
"Key"=My Value

This would actually be necessary if you needed an equal sign in the key. I might consider this. But it's different from what you need.

I couldn't find where the Wikipedia article talked about quoted values.

from inifileparser.

lmattcris avatar lmattcris commented on June 21, 2024

Oh, I think their text is a bit convoluted, but when they write

If the string associated with lpKeyName is enclosed in single or double quotation marks, the marks are discarded when the GetPrivateProfileString function retrieves the string

it refers to the value string to be assigned... I hope - you retrieve the value string, reasonably
I've never seen key names with spaces in between, while I've seen quite often values quoted, as in the Wikipedia example at the link above:

[database]
; use IP address in case network name resolution is not working
server = 192.0.2.62     
port = 143
file = "payroll.dat"

And in text

Quoted values
Some implementations allow values to be quoted, typically using double quotes and/or apostrophes. This allows for explicit declaration of whitespace, and/or for quoting of special characters (equals, semicolon, etc.). The standard Windows function GetPrivateProfileString supports this, and will remove quotation marks that surround the values.

from inifileparser.

SoftCircuits avatar SoftCircuits commented on June 21, 2024

I'm closing this issue for now. I don't see anyone else needing this and removing quotes now could potentially break existing code that expects quotes to be left in.

Feel free to reach out if you can think of any other arguments for making a change here.

from inifileparser.

Related Issues (3)

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.