Skip to content

Commit 035f885

Browse files
committed
Fix for #29
1 parent 88efc76 commit 035f885

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ matrix:
2222
- os: linux
2323
dist: trusty
2424
sudo: required
25-
env: SWIFT_SNAPSHOT=4.0-DEVELOPMENT-SNAPSHOT-2017-06-29-a
25+
env: SWIFT_SNAPSHOT=4.0-DEVELOPMENT-SNAPSHOT-2017-08-15-a
2626
- os: osx
2727
osx_image: xcode8.3
2828
sudo: required
2929
- os: osx
3030
osx_image: xcode9
3131
sudo: required
32-
env: SWIFT_SNAPSHOT=4.0-DEVELOPMENT-SNAPSHOT-2017-06-29-a
32+
env: SWIFT_SNAPSHOT=4.0-DEVELOPMENT-SNAPSHOT-2017-08-15-a
3333

3434
before_install:
3535
- git clone https://github.com/IBM-Swift/Package-Builder.git

Sources/HTMLEntities/String+HTMLEntities.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,13 @@ public extension String {
171171
else {
172172
// false alarm, not a character reference
173173
// move back to invalid state
174-
entityPrefix = ""
175174
state = .Invalid
176175

177176
// move the consumed & and current unicode to result buffer
178177
str += entityPrefix + unicodeAsString
178+
179+
// clear entityPrefix buffer
180+
entityPrefix = ""
179181
}
180182
case .Number:
181183
// previously parsed &#

Tests/HTMLEntitiesTests/HTMLEntitiesTests.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,9 @@ class HTMLEntitiesTests: XCTestCase {
283283
XCTFail("Wrong error thrown")
284284
}
285285

286+
// unit test for fix to https://github.com/IBM-Swift/swift-html-entities/issues/29
287+
XCTAssertEqual("&+&#4370ᅡ&#4523".htmlUnescape(), "&+한")
288+
286289
// test various parse errors
287290
XCTAssertEqual(try "&∾̳".htmlUnescape(strict: true), "&∾̳")
288291
XCTAssertEqual("&#∾̳".htmlUnescape(), "&#∾̳")

0 commit comments

Comments
 (0)