3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/nixos/lib
aszlig cb796ccd09
nixos/test-driver/Logger: Replace invalid UTF-8
Regression introduced by d84741a4bf.

The mentioned commit actually is a good thing, because we now get the
output from the X session.

Unfortunately, for the i3wm test, the i3-config-wizard prints out the
raw keyboard symbols directly coming from xcb, so the output isn't
necessarily proper UTF-8.

As the XML::Writer already expects valid UTF-8 input, we assume that
everything that comes into sanitise() will be UTF-8 from the start. So
we just decode() it using FB_DEFAULT as the check argument so that
every invalid character is replaced by the unicode replacement
character:

https://en.wikipedia.org/wiki/Specials_(Unicode_block)#Replacement_character

We simply re-oncode it again afterwards and return it, so we should
always get out valid UTF-8 in the log XML.

For more information about FB_DEFAULT and FB_CROAK, have a look at:

http://search.cpan.org/~dankogai/Encode-2.84/Encode.pm#Handling_Malformed_Data

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2016-05-26 14:24:33 +02:00
..
test-driver nixos/test-driver/Logger: Replace invalid UTF-8 2016-05-26 14:24:33 +02:00
build-vms.nix nixos/lib/testing.nix: make 'config' a free variable 2016-03-29 14:16:54 +01:00
eval-config.nix Revert "Add the tool "nixos-typecheck" that can check an option declaration to:" 2016-03-01 20:52:06 +01:00
from-env.nix
make-channel.nix Unify NixOS and Nixpkgs channel structure 2015-08-05 17:37:11 +02:00
make-disk-image.nix treewide: Use correct output in ${config.nix.package}/bin 2016-04-25 16:44:37 +02:00
make-ext4-fs.nix nixos: Add derivations for SD card installation images on ARM 2015-07-26 00:31:20 +03:00
make-iso9660-image.nix Combine ISO generation steps 2016-03-15 14:15:12 +01:00
make-iso9660-image.sh Combine ISO generation steps 2016-03-15 14:15:12 +01:00
make-squashfs.nix
make-system-tarball.nix nixos/make-system-tarball: extra commands to be executed before archive 2014-12-11 23:17:27 +01:00
make-system-tarball.sh nixos/make-system-tarball: extra commands to be executed before archive 2014-12-11 23:17:27 +01:00
qemu-flags.nix
testing.nix nixos/lib/testing.nix: make 'config' a free variable 2016-03-29 14:16:54 +01:00
utils.nix