An iCalendar library for Go.
MIT
An iCalendar library for Go
License: MIT License
An iCalendar library for Go.
MIT
In line of our earlier discussion, escaping should happen without the user having to think about it. At the moment this isn't yet the case. The following two pieces of code have a different result:
e.Props.Set(&ical.Prop{
Name: ical.PropDescription,
Value: `Hello world!\n-:-;`,
})
// produces: Hello world!\n-:-;
e.Props.SetText(ical.PropDescription, `Hello world!\n-:-;`)
// produces: Hello world!\\n-:-\;
I've a lot of events that look like this:
BEGIN:VCALENDAR
PRODID:-//Radicale//NONSGML Radicale Server//EN
VERSION:2.0
BEGIN:VTIMEZONE
TZID:local
X-RADICALE-NAME:local
BEGIN:STANDARD
DTSTART:20090314T230000
TZNAME:ART
TZOFFSETFROM:-0200
TZOFFSETTO:-0300
X-RADICALE-NAME:local
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
SUMMARY:Redacted summary
DTSTART;TZID="local;VALUE=DATE-TIME":20150315T123000
DTEND;TZID="local;VALUE=DATE-TIME":20150315T193000
DTSTAMP:20150315T103349Z
UID:762CJK7VMGEBP416C5TE3V6KFHVJXY2Y6IPD
SEQUENCE:0
X-RADICALE-NAME:762CJK7VMGEBP416C5TE3V6KFHVJXY2Y6IPD.ics
END:VEVENT
END:VCALENDAR
This doesn't seem to be invalid; the timezone is specific in the file. However, parsing these returns error unknown time zone local
.
As RFC5545 states:
Lines of text SHOULD NOT be longer than 75 octets, excluding the line break. Long content lines SHOULD be split into a multiple line representations using a line "folding" technique.
This is currently not supported. Lines are completely posted into the output without folding.
Hi,
Prop.SetText()
applies value escaping through Prop.SetTextList()
. However it's currently too opinionated to use a general value escaping. I propose to open up the escaping, te be re-used for more complex situations:
// Potentially problematic, since none of the parameters or the value is escaped.
e.Props.Set(&ical.Prop{
Name: ical.PropOrganizer,
Params: ical.Params{
ical.ParamCommonName: []string{organiser.Name},
},
Value: fmt.Sprintf("MAILTO:%s", organizer.EmailAddress),
})
Now we need to duplicate the escaping functionality to make sure that the value passed here is also properly escaped. Ideally I would like to see an ical.EscapeValue()
which does so that there can be consistent escaping.
func EscapeValue(s string) string {
var sb strings.Builder
sb.Grow(len(s))
for _, r := range s {
switch r {
default:
sb.WriteRune(r)
case '\\', ';', ',':
sb.WriteByte('\\')
sb.WriteRune(r)
case '\n':
sb.WriteString(`\n`)
// Should \r's be written at all, or is it safe to skip these?
case '\r':
continue
}
}
return sb.String()
}
Mostly new params/props definitions: https://tools.ietf.org/html/rfc7986
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.