Talk:Hex dump: Difference between revisions
Content added Content deleted
(Better input/output requirements) |
m (Sign my last comment) |
||
(11 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
== Better input/output requirements == |
== Better input/output requirements == |
||
The current example (and required input) being encoded in UTF-16 was not intended to be a significant part of the task, but just small sample of bytes, some of which are outside the ASCII range, including some non-printing ASCII. As an output requirement, perhaps the first 128 bytes of the Rosetta Code logo ("RosettaCodeTitle.ico") would be better? Or the first X bytes of the task implementation's source code? |
The current example (and required input) being encoded in UTF-16 was not intended to be a significant part of the task, but just a small sample of bytes, some of which are outside the ASCII range, including some non-printing ASCII. As an output requirement, perhaps the first 128 bytes of the Rosetta Code logo ("RosettaCodeTitle.ico") would be better? Or the first X bytes of the task implementation's source code? |
||
:The given example is better than either, all <nowiki>{{out}}</nowiki> should be the same or easily comparable. --[[User:Petelomax|Petelomax]] ([[User talk:Petelomax|talk]]) 13:45, 30 October 2023 (UTC) |
|||
⚫ | |||
⚫ | |||
<syntaxhighlight lang="python"> |
<syntaxhighlight lang="python"> |
||
s = "Rosetta Code is a programming chrestomathy site \U0001F600. |
s = "Rosetta Code is a programming chrestomathy site \U0001F600." |
||
with open("example_utf16.txt", "wb") as of |
with open("example_utf16.txt", "wb") as of |
||
of.write(s.decode("utf-16")) |
of.write(s.decode("utf-16")) |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
--[[User:Jgrprior|Jgrprior]] ([[User talk:Jgrprior|talk]]) 06:27, 30 October 2023 (UTC) |
--[[User:Jgrprior|Jgrprior]] ([[User talk:Jgrprior|talk]]) 06:27, 30 October 2023 (UTC) |
||
:Nevermind (the deleted remarks), I just found a neater way for the Phix entry. --[[User:Petelomax|Petelomax]] ([[User talk:Petelomax|talk]]) 14:54, 30 October 2023 (UTC) |
|||
:: 👍 Somehow, in my head, I managed to combine your original comments and PureFox's, and came up with something that was mostly nonsense. --[[User:Jgrprior|Jgrprior]] ([[User talk:Jgrprior|talk]]) 16:50, 31 October 2023 (UTC) |
|||
:::Although UTF-16 is an encoding you'd normally associate with Windows, I was pleasantly surprised when ''gedit'' (Ubuntu's equivalent of ''notepad'') supported it. So no subsequent conversions were necessary :) --[[User:PureFox|PureFox]] ([[User talk:PureFox|talk]]) 16:17, 31 October 2023 (UTC) |
Latest revision as of 16:50, 31 October 2023
Better input/output requirements
The current example (and required input) being encoded in UTF-16 was not intended to be a significant part of the task, but just a small sample of bytes, some of which are outside the ASCII range, including some non-printing ASCII. As an output requirement, perhaps the first 128 bytes of the Rosetta Code logo ("RosettaCodeTitle.ico") would be better? Or the first X bytes of the task implementation's source code?
- The given example is better than either, all {{out}} should be the same or easily comparable. --Petelomax (talk) 13:45, 30 October 2023 (UTC)
For what it's worth, my editor doesn't do UTF-16 either. I used something like the following Python code to generate a sample file.
s = "Rosetta Code is a programming chrestomathy site \U0001F600."
with open("example_utf16.txt", "wb") as of
of.write(s.decode("utf-16"))
--Jgrprior (talk) 06:27, 30 October 2023 (UTC)
- Nevermind (the deleted remarks), I just found a neater way for the Phix entry. --Petelomax (talk) 14:54, 30 October 2023 (UTC)