Sorry, not a third-party problem, only a DAVdroid bug.
Persian locale causes invalid time values in iCalendar/vCard
danialbehzadi last edited by rfc2822
In Persian locale, I get error on every update sync with a time. This includes every calendar update ir time-based updates in contacts, like updating birthdays or even starring contacts who has a birthday set for them.
Here is a general calendar update error log: https://paste.ubuntu.com/p/2pgZVGgFKk/
Here is a contact update with birthday:
The cause is the numbers such as timezone or birthdate are in Persian locale script, but DAVx expects to see Latin number characters there.
I think the easiest way to fix this is to map other number characters to Latin ones on the go.
Thanks for your report.
The cause is the numbers such as timezone or birthdate are in Persian locale script, but DAVx5 expects to see Latin number characters there.
Yes. Those numbers are not intended for humans and must not be localized. They are standardized in the iCalendar and vCard standards and must contain ASCII representations of numbers.
How did you generate those (invalid) events/vCards?
@rfc2822 Android 10 makes them so in Persian locale by default. Nothing did manipulate them in any way at all.
@danialbehzadi I’d need steps to reproduce. Did you generate those events/vCards on the server / with another client or with DAVx5? What do I have to do to reproduce this problem?
When I add birthday on Nextcloud web interface, there’s no error with syncing. But if I star that contact or do any edit on them on phone, DAVx5 refuse to sync them back to server.
The interesting part is that Android itself has no problem with this contact and it continues to work normally even with (as you say) malformed vCard, just like when I add birthday directly from phone.
@danialbehzadi So I have to
- set a test Nextcloud to Persian,
- create a contact there,
- sync it with DAVx5 (Android also Persian),
- change it on Android,
- sync again to upload the change?
danialbehzadi last edited by danialbehzadi
Yes. That will show you the case. However the Nexcloud doesn’t necessarily have to be in Persian locale.
The most simple case is:
- Change Android 10 locale to Persian
- Add birthday to an existing contact on Android 10
- Sync DAVx5 contacts
@danialbehzadi Thanks I’ll have a try
Regarding events: The debug info #1 shows a parsing error:
at.bitfire.ical4android.InvalidCalendarException: Couldn’t parse iCalendar
Caused by: net.fortuna.ical4j.data.ParserException: Error at line ۱۰:Invalid ID for ZoneOffset, non numeric characters found: +۰۳۳۰
which means that the invalid event has been received (not sent) by DAVx5.
How did you generate the event?
Regarding contacts: Here it really looks like DAVx5 generates those invalid dates, but I don’t have an idea why and I can’t reproduce it yet. I have done the three steps from above, but DAVx5 doesn’t generate those localized dates here.
I can’t reproduce the problem at all (Nextcloud 20, Android 10 emulator). Even if I set both to Persian and create and modify events and contacts, no problem. Also I don’t have an idea how such a problem could occur.
Also, I think if this problem would generally occur with Persian locale, we would already have got a report.
Since when does this problem occur? Did you have a working installation before?
In the debug info, your locale is:
┌────────┐ │ locale │ ├────────┤ │ fa_IR │ └────────┘
In my testing debug info, it’s:
┌──────────────────┐ │ locale │ ├──────────────────┤ │ fa_IR_#u-nu-latn │ └──────────────────┘
(But I don’t understand the Persian language or signs ️, so I don’t know which variant I have actually selected.)
That’s interesting, because “u-nu-latn” sounds like a variant with latin numbers, which could be related to the problem.
How did you set your locale und to which exact value (as you see it in your Android settings, original language)? (If you have multiple locales, please provide all values and how you have set them)
j-ed last edited by
@rfc2822 I’m not able to read Farsi, but I’ve searched the Internet for related locale problems and found the following information which might help you understanding/solving this issue:
Android locale configuration:
java Locale.Builder setExtension(Locale.UNICODE_LOCALE_EXTENSION …):
Ah forget it, I could reproduce the problem. There are different variants in the Android locale settings:
- Persian (Iran) – ایران (?) → problem occurs
- Persian (Iran) western digits – ایران (ارقام غربی) (?) → no problem
and two others which I don’t understand (yet).
So the question is why ez-vcard and ical4j generate localized numbers (instead of ASCII numbers) when the first locale is selected. Maybe some system function generates them…
@danialbehzadi Can you confirm that it works as expected with “Iran (western digits)”?
This post is deleted!
@danialbehzadi Thanks for the report. I think I have found the problem now and will do further research and report it to the respective libraries. Until then, please use the “western digits” variant on your Android device.
I confirm that it works fine under Western digits variant of Persian. But everything with numbers looks ugly now
@danialbehzadi Yes, that won’t be necessary as soon as this is fixed. Unfortunately it’s not directly in the DAVx5 code, but in used libraries.
- ez-vcard report: https://github.com/mangstadt/ez-vcard/issues/113
- ical4j report: https://github.com/ical4j/ical4j/issues/458
I faced with this issue for calendar. I had my calendar synced with Nextcloud. In one of the calendars, I added an event on my phone (which uses Persian language) and set reminder. Thereafter, I had sync issue.
Today I looked at the
.icsfile and saw this:
You can clearly see on TRIGGER line, there are Persian numbers.
I manually edited the file and made a new calendar on Nextcloud. It is working fine now.
Just the point is title or description shouldn’t be modified. Only those lines should be modified which use number for some calculation.