Skip to content

Use of certain unicode characters in translated code examples may break the code #3490

@ethancrawford

Description

@ethancrawford

As originally pointed out on in_thread at https://in-thread.sonic-pi.net/t/runtime-error-live-coding-tutorial/9858, there are certain situations where copying and pasting code examples from the tutorial into the editor to run, may instead produce an error, such as undefined method 'live_loop ', (or similar for other Sonic Pi commands).

This happens due to the community translations being created with non-standard characters being used in place of the usual ones when describing the Ruby code. For example, the issue in the above forum post occurs when the example defined in the French translation is used. Visually, it looks virtually identical to the English version, but when inspecting the unicode characters themselves, the code numbers are different.
English version:

live_loop :flibble

The space character here is U+0020 (ASCII space).

French version:

live_loop :flibble

The 'space' character here is actually U+202F (Narrow No-Break Space - NNBSP)

...Incidentally, how truthful it is I can't say, but Claude states that U+202F is commonly used in French text formatting, particularly:

  • Before colons, semicolons, exclamation marks, and question marks
  • In number formatting (e.g., "1 000" instead of "1,000")

... but back to the issue - This will mean that translations will need to be handled a little bit more carefully somewhere.
I'm not sure of the right place - but there will at least need to be some kind of thing happening that means that the code examples can be copied and pasted straight away without causing an error like described above.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions