Skip to content

Instantly share code, notes, and snippets.

View cbracken's full-sized avatar
☮️
Give peace a chance

Chris Bracken cbracken

☮️
Give peace a chance
View GitHub Profile
@cbracken
cbracken / decode_syslog.dart
Last active November 28, 2023 11:27
Quickly hacked-up decoder for syslog lines in macOS/iOS syslog
import 'dart:convert' show utf8;
/// Decodes a vis-encoded syslog string to a UTF-8 representation.
///
/// Apple's syslog logs are encoded in 7-bit form. Input bytes are encoded as follows:
/// 1. 0x00 to 0x19: non-printing range. Some ignored, some encoded as <...>.
/// 2. 0x20 to 0x7f: as-is, with the exception of 0x5c (backslash).
/// 3. 0x5c (backslash): octal representation \134.
/// 4. 0x80 to 0x9f: \M^x (using control-character notation for range 0x00 to 0x40).
/// 5. 0xa0: octal representation \240.