... ($loggingEnabled) { error_log("Error reading record at index $index"); } return null; } $result = []; $fieldOffset = 1; // Skipping the deleted flag byte foreach ($fields as $field) { $fieldValue = trim(substr($record, $fieldOffset, $field['length'])); $result[$field['name']] = my_utf8_encode($fieldValue); ...