[Webkit-unassigned] [Bug 193339] Either StringView::UpconvertedCharacters::UpconvertedCharacters() or StringImpl::createCFString() is using the wrong encoding

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jan 10 16:20:03 PST 2019


https://bugs.webkit.org/show_bug.cgi?id=193339

--- Comment #7 from Myles C. Maxfield <mmaxfield at apple.com> ---
Looks like it is true. Sorry for the noise.

var error = U_ZERO_ERROR
var i = Int8(1)
for item in 1 ... 0xFF {
    let source = [Int8(i)]
    let targetCapacity = ucnv_convert_63("UTF-16", "ISO-8859-1", nil, 0, source, Int32(source.count), &error)
    assert(error.rawValue > U_ZERO_ERROR.rawValue)
    error = U_ZERO_ERROR
    var target = [Int8](repeating: 0, count: Int(targetCapacity))
    ucnv_convert_63("UTF-16", "ISO-8859-1", &target, Int32(target.count), source, Int32(source.count), &error)
    target.withUnsafeBytes() {(unsafeRawBufferPointer: UnsafeRawBufferPointer) in
        let unsafeBufferPointer = unsafeRawBufferPointer.bindMemory(to: UInt16.self)
        for j in 0 ..< unsafeBufferPointer.count {
            print("\(String(item, radix: 16)) Code Unit \(j) -> \(String(unsafeBufferPointer[j], radix: 16))")
        }
        assert(unsafeBufferPointer.count == 2)
        assert(unsafeBufferPointer[0] == 0xfeff)
        assert(unsafeBufferPointer[1] == item)
    }
    i = i.addingReportingOverflow(1).partialValue
}


...
Program ended with exit code: 0

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20190111/61ec0e68/attachment-0001.html>


More information about the webkit-unassigned mailing list