Ok, I tested a little bit more. It seems that when I do foo, it will print out the code point from the utf-8 perspective, as in what char does that correspond to. Yet, the reverse operation will print out from code point from command prompt perspective.
So, when developing this, I have to see which ones they have in common within range 0-255. And then notify via CLI help that some characters are not compatible. In case of working with code page 437, a simple mapping back to 437 would work in most cases.
EDIT:
I made this code in order to test my idea:
#@cli rep_utf8_2_437
#@cli : Map UTF-8 values into corresponding Code Page 437 values
rep_utf8_2_437:
base642img MSB1aW50OCBsaXR0bGVfZW5kaWFuCjI1NiAxIDEgMSAjMjY3CnicAQAB//4AAQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyAhIiMkJSYnKCkqKywtLi8wMTIzNDU2Nzg5Ojs8PT4/QEFCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaW1xdXl9gYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXp7fH1+f4CBgoOEhYaHiImKi4yNjo+QkZKTlJWWl5iZmpucnZ6f/62bnKSdphWoqaauqq2ur/jx/bO05hT6uLmnr6yrvqjAwcLDjo+SgMiQysvMzc7P0KXS09TVmdfY2drbmt3e4YWgg+OEhpGHioKIiY2hjIvwpJWik/WU9viXo5aB/f6YuY50nQ==
map[^-1] [-1] rm.
According to the result:
E:\>gmic ('¶§') rep_utf8_2_437 echo {t}
[gmic]./ Start G'MIC interpreter (v.3.4.1). (1 image 2x1x1x1).
¶§
[gmic]./ Display image [0] = '('╢º')'.
[0] = '('╢º')':
size = (2,1,1,1) [8 b of float32].
data = (20,21).
min = 20, max = 21, mean = 20.5, std = 0.707107, coords_min = (0,0,0,0), coords_max = (1,0,0,0).
[gmic]./ End G'MIC interpreter.
The echo matches the initial image. Proving that I am on the correct path!
Next up is code page 850, and then I can continue with string processing.