@@ -1,7 +1,7 @@ /* - * Copyright (c) 2008-2021 Jonathan Schleifer + * Copyright (c) 2008-2022 Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in @@ -1082,10 +1082,14 @@ data = [OFData dataWithContentsOfURL: URL]; } @catch (id e) { [self release]; @throw e; } + + /* FIXME: Detect encoding where we can. */ + if (encoding == OFStringEncodingAutodetect) + encoding = OFStringEncodingUTF8; self = [self initWithCString: data.items encoding: encoding length: data.count * data.itemSize];