Using Swift to unescape unicode characters, ie \u1234

It’s fairly similar in Swift, though you still need to use the Foundation string classes: let transform = “Any-Hex/Java” let input = “\\u5404\\u500b\\u90fd” as NSString var convertedString = input.mutableCopy() as NSMutableString CFStringTransform(convertedString, nil, transform as NSString, 1) println(“convertedString: \(convertedString)”) // convertedString: 各個都 (The last parameter threw me for a loop until I realized that Boolean … Read more

How to unmask a JavaFX PasswordField or properly mask a TextField?

> However, I cannot find anything in the JavaFX API that let me do that? The PasswordField component does not display masked text by default. However you can use PasswordField with TextField and toggle masked/unmasked text using these components respectively. Where the unmasked text is shown by TextField, as in example demo below. > I … Read more

What is the maximum number of bytes for a UTF-8 encoded character?

The maximum number of bytes per character is 4 according to RFC3629 which limited the character table to U+10FFFF: In UTF-8, characters from the U+0000..U+10FFFF range (the UTF-16 accessible range) are encoded using sequences of 1 to 4 octets. (The original specification allowed for up to six byte character codes for code points past U+10FFFF.) … Read more