Skip to content

Commit

Permalink
Use a funnier charset name
Browse files Browse the repository at this point in the history
  • Loading branch information
mebeim committed Jan 26, 2022
1 parent e107142 commit 3d50865
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions expl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ set -e
# │   └── fake_exe
# └── fake_exe
#    ├── gconv-modules
#    └── UTF-16.so
#    └── fake_module.so

mkdir -p 'GCONV_PATH=.'
touch 'GCONV_PATH=./fake_exe'
chmod +x 'GCONV_PATH=./fake_exe'

mkdir -p fake_exe
echo 'module INTERNAL UTF-16// UTF-16 1' > fake_exe/gconv-modules
echo 'module INTERNAL banana// fake_module 1' > fake_exe/gconv-modules

gcc -o helper helper.c
gcc -fPIC -shared -o fake_exe/UTF-16.so fake_module.c
gcc -fPIC -shared -o fake_exe/fake_module.so fake_module.c

set +e
env PATH="$(pwd):$PATH" ./helper
Expand Down
8 changes: 5 additions & 3 deletions helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ int main(void) {
// validate_environment_variable() fails, calling g_printerr().
"SHELL=x",

// An encoding that is not UTF-8, so g_printerr() invokes a loadable
// module (fake_module.c) for string conversion from GCONV_PATH.
"CHARSET=UTF-16",
// An encoding that is not UTF-8 (even made up), so g_printerr() invokes
// a loadable module for string conversion as specified by the config
// file $GCONV_PATH/gconv-modules, which in this case will point to
// fake_module.so compiled from fake_module.c.
"CHARSET=banana",
NULL
};

Expand Down

0 comments on commit 3d50865

Please sign in to comment.