Open swift-ci opened 4 years ago
Comment by Steven W. Klassen (JIRA)
It appears that it is not recognizing it as valid XML. However, the constructor is not giving any indication of this. Specifically it is not throwing an exception, nor returning an error or nil. From the init description, and from the apple docs, it would seem it should be throwing an exception.
I am new to the Swift project (this would be my first contribution) - would this be a good first issue?
Still crashing in 5.3 and current Swift main
$ jw-docker-swift-main
docker.io/swiftlang/swift:nightly-main-bionic
################################################################
# #
# Swift Nightly Docker Image #
# Tag: swift-DEVELOPMENT-SNAPSHOT-2021-04-18-a #
# #
################################################################
root@0ae6b2f0fd1a:/Users/johannes/devel/swift-corelibs-foundation# swift
Welcome to Swift version 5.5-dev (LLVM fb5a91b4e892ed9, Swift f17142883421ec0).
Type :help for assistance.
1> import Foundation
2. import FoundationXML
3. let s1 = "<tag>hi</tag>"
4. let doc = XMLDocument(xmlString: s1)
5. doc.characterEncoding
s1: String = {
_guts = {
_object = {
_countAndFlagsBits = <extracting data from value failed>
_object = <extracting data from value failed>
}
}
}
doc: XMLDocument = <extracting data from value failed>
Execution interrupted. Enter code to recover and continue.
Enter LLDB commands to investigate (type :help for assistance.)
@swift-ci create
Environment
Ubuntu Linux using Swift 5.2.4.Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: cad0bbeba9e4946e8620ef9213d72704Issue Description:
Specifically, I tried the following...
On the mac (Apple Swift version 5.2.4) this prints "UTF-8".
But on Linux (Swift version 5.2.4) this gives me a seg fault (signal 11). (In lldb it just says "Execution interrupted.")
I would assume that the correct answer would either be "UTF-8" or possibly nil given that no encoding was specified.