Open Bug 274567 Opened 17 years ago Updated 3 years ago

Serialized date contains wrong encoding chars

Categories

(Core Graveyard :: RDF, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

People

(Reporter: torisugari, Unassigned)

References

()

Details

When I serialize a datasource which has nsIRDFDate, 
output string contains "東京(標準時)", 
due to ::strftime() on MS Windows.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_strftime.2c_.wcsftime.asp
>Either the time-zone name or time zone abbreviation,
>depending on registry settings

The problem is this string is encoded in Shift_JIS,
while rdf serializer assumes it should be a pure ascii string..
Then serialized rdf file has mixed encodings: UTF-8 and Shift_JIS. 

In my opinion, there's no need to append the time zone name.

http://lxr.mozilla.org/mozilla/source/rdf/base/src/rdfutil.cpp#174
> 174     // Outputs Unixish date in GMT plus usecs; e.g.,
> 175     //   Wed Jan  9 19:15:13 GMT 2002 +002441

According to the comment, we should use "GMT" instead of "%z".

W3C's "Date and Time Formats"(ISO 8601) is another way to go.
http://www.w3.org/TR/rdf-syntax-grammar/#section-Serialising
http://www.w3.org/TR/NOTE-datetime
http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/#dateTime
http://www.cl.cam.ac.uk/~mgk25/iso-time.html

e.g. "2004-12-14T18:37:20.000000+09:00"
One of the things on my list, though pretty way down on it. Dates are just too
char consuming, RDFXML isn't meant to be read by humans, so there is no point in
putting in more info than required to parse the date.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Depends on: 302387
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.