0
\$\begingroup\$

This question already has an answer here:

So, I'm creating a language using UTF-8 characters. It is a functional language, but I decided to create a golfing version of it. The problem is that the golfed functions use multibyte characters, so the language is losing score.

I saw that Jelly uses it's own encoding (or how is that called), which can be converted to UTF-8 and still count as if it was in the original encoding.

My language uses UTF-8 encoding and literals, not every character is a custom function.

Is it possible to count a multibyte character as just 1 byte in such situation? If not, how can I make my language not lose score and still look the same?

I also saw this answer - https://codegolf.meta.stackexchange.com/a/9523/72792 - Can I create my own encoding (ex. characters 0-9 have code 0-9, not 48-57 like in Unicode) or use Jelly Code Page, then use utf-8 character eqivalents as single-byte?

TL;DR: Can I count multibyte characters as single byte in custom language? Or, can I use custom encoding for the language and still use it on PPCG?

\$\endgroup\$

marked as duplicate by Stephen, DJMcMayhem, dzaima, totallyhuman, ATaco Aug 18 '17 at 14:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    \$\begingroup\$ See the answer from this question: there must be an actual file with the claimed byte count that, when fed to your interpreter, runs the intended program \$\endgroup\$ – Stephen Aug 18 '17 at 14:27
  • 1
    \$\begingroup\$ If you use a custom encoding, you will most likely lose the ability to do arbitrary Unicode string literals - because Jelly uses 256 single bytes characters, those are the only characters valid in Jelly programs \$\endgroup\$ – Stephen Aug 18 '17 at 14:28
  • \$\begingroup\$ @StepHen Well, Jelly can still use other characters in strings, but in that case the program has to be counted as UTF-8, not Jelly encoding. \$\endgroup\$ – Business Cat Aug 18 '17 at 14:30
  • \$\begingroup\$ @BusinessCat and you need to use the UTF-8 flag, otherwise it will still interpret the bytes as Jelly \$\endgroup\$ – Stephen Aug 18 '17 at 14:31
  • \$\begingroup\$ The "possible duplicate" isn't exactly same, but it's hard for me to explain. If my language uses UTF-8 and for example it doesn't make use of control characters (there are at least 32 in unicode), can I then count characters like 260, which without control chars is 228, as 1 byte? \$\endgroup\$ – RedClover Aug 18 '17 at 14:35
  • \$\begingroup\$ You can't have your cake and eat it, too. Step Hen's comment above has it correct -- if you have a file that is foo bytes, and that file gets fed into your interpreter as-is and works, you can claim foo bytes as your score. \$\endgroup\$ – AdmBorkBork Aug 18 '17 at 14:38
  • 2
    \$\begingroup\$ @Soaku If you manage to make some conversion process that converts a UTF-8 file to a file with the byte count X, then an answer with the byte count X is valid. If there is no file with the length X that represents the same program, the byte count X is invalid. \$\endgroup\$ – dzaima Aug 18 '17 at 14:39
  • \$\begingroup\$ @dzaima you made that clear, thanks. So ok, now I understand it. \$\endgroup\$ – RedClover Aug 18 '17 at 14:41
  • 1
    \$\begingroup\$ @Soaku glad you figured it out, dzaima is correct. sorry if I was a bit short, I was busy :) \$\endgroup\$ – Stephen Aug 18 '17 at 14:42
  • 1
    \$\begingroup\$ @StepHen wat. Charcoal still has Unicode characters, although there are represented by different codepoints in its codepage \$\endgroup\$ – ASCII-only Aug 21 '17 at 13:04
  • \$\begingroup\$ @ASCII-only I mean you can't write out a literal string in your source that contains characters outside your codepage - for example, you couldn't store Jelly codepage as a straight string literal, because you can't use those chars in your codepage. \$\endgroup\$ – Stephen Aug 21 '17 at 14:05
  • \$\begingroup\$ @StepHen yes I can :P they just won't be one byte each \$\endgroup\$ – ASCII-only Aug 21 '17 at 14:07

Browse other questions tagged .