Skip to content

Instantly share code, notes, and snippets.

@fdstevex
Created July 27, 2020 11:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fdstevex/5412fad1d205e8b00ad6288e0769389b to your computer and use it in GitHub Desktop.
Save fdstevex/5412fad1d205e8b00ad6288e0769389b to your computer and use it in GitHub Desktop.
#!/bin/swift
// Print all the characters in the "Supplementary Private Use Area-B" block.
import Cocoa
for ch:UInt32 in 0x100000..<0x10FFFF {
let arr = [ch]
let array: [UInt32] = [CFSwapInt32(ch)]
let data = array.withUnsafeBytes { (ptr) -> Data in
return Data(ptr)
}
if let str = String(data: data, encoding: .utf32) {
print("\(String(format: "%08X", ch)): \(str)")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment