Index: src/OFDate.m ================================================================== --- src/OFDate.m +++ src/OFDate.m @@ -31,10 +31,11 @@ # import "OFMutex.h" #endif #import "OFStrPTime.h" #import "OFString.h" #import "OFSystemInfo.h" +#import "OFXMLAttribute.h" #import "OFXMLElement.h" #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" @@ -504,10 +505,14 @@ unsigned long long value; if (![element.name isEqual: @"OFDate"] || ![element.namespace isEqual: OFSerializationNS]) @throw [OFInvalidArgumentException exception]; + + if (![[element attributeForName: @"encoding"].stringValue + isEqual: @"hex"]) + @throw [OFInvalidFormatException exception]; value = [element unsignedLongLongValueWithBase: 16]; if (value > UINT64_MAX) @throw [OFOutOfRangeException exception]; @@ -588,10 +593,11 @@ OFXMLElement *element; element = [OFXMLElement elementWithName: @"OFDate" namespace: OFSerializationNS]; + [element addAttributeWithName: @"encoding" stringValue: @"hex"]; element.stringValue = [OFString stringWithFormat: @"%016" PRIx64, OFFromBigEndian64(OFDoubleToRawUInt64(OFToBigEndianDouble( self.timeIntervalSince1970)))]; [element retain]; Index: tests/serialization.xml ================================================================== --- tests/serialization.xml +++ tests/serialization.xml @@ -55,13 +55,13 @@ Qu"xbar test 1234 40934a456d5cfaad asd - 40934a456d5cfaad + 40934a456d5cfaad Hello