I’m starting to work on the Rosetta Code Hex Dump task.
I really do not know how to create a UTF-16 string to test the ccde that I’m about to write. Seems like a very elementary question, but if you’ll could give me a hint, that would be cool.
If there is a Rosetta Code task that already give me a running start on this problem, then I missed it completely (like right under my nose).
My attemtps at copy-paste result in a UTF-8 string.
I’m on a Mac, using iTerm2 as a terminal.
Update: I see in the discussion tab, that somebody used a Python script to generate the UTF-16 test string. Since that script was also provided, I’ll use that until there is better advice (if any) of you intelligentsia here…
Another suggestion: XML/Ada has full support for unicode (namely unicode-ces-utf16.ads here). It was developed in 2001, and is quite monolithic unfortunately. Nowadays, I would split this unicode support into its own Alire package.
There are of course a lot of other packages that provide such support (as a community, we still like to reimplement things rather than try and find a single good package that everyone would rally with – I am no better than others here)
It’s definitely a tricky situation to do that. Any time you rely on multiple outside packages you run the very common risk of having to deal with keeping your code up to date with changes made by all of them when they are updated, and some of those changes might be major API changes. You can try freezing your dependencies, but then if you find any bugs, most folks won’t accept bug reports if you aren’t using the most recent version (understandably).
Note, I am not anit “use other libraries” but I understand the hesitation. I split the difference on my end. For some projects I rely on other libraries (I commonly rely on Gnoga, Simple Components, and Pragmarc for example). For some projects I want to learn new things and may roll my own, or if I a myself am trying to provide a utility library, and the utility is small enough, I’ll do it myself to keep the library dependencies simple.