String -- double interpretion

Hi,
How do I "evaluate" the \\special letters?
     x='legend\\u00e4ren Sinnspr\\u00fcchen verf\\u00fchrte'
     Idea: How can I get the (interpreted!) output of print (what is shown on the screen) into a variable?
     [ 1) output is not what is shown on the screen, 2) print has no ouput ]

thanks, Opti

···

On 10/22/2016 02:35 PM, Die Optimisten wrote:

Hi,
How do I "evaluate" the \\special letters?
    x='legend\\u00e4ren Sinnspr\\u00fcchen verf\\u00fchrte'
    Idea: How can I get the (interpreted!) output of print (what is shown on the screen) into a variable?
    [ 1) output is not what is shown on the screen, 2) print has no ouput ]

thanks, Opti

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt;

Quoting Die Optimisten (inform@die-optimisten.net):

Hi,
How do I "evaluate" the \\special letters?
    x='legend\\u00e4ren Sinnspr\\u00fcchen verf\\u00fchrte'
    Idea: How can I get the (interpreted!) output of print (what is shown on
the screen) into a variable?
    [ 1) output is not what is shown on the screen, 2) print has no ouput ]

Your mail is not very clear, I am afraid. What I can tell you is that
I can save a string with proper umlauts in a variable like this:

x="legend\u00e4ren Sinnspr\u00fcchen verf\u00fchrte"
puts x
legendären Sinnsprüchen verführte

Note the double quotes in place of single quotes, and the single
backslashes. Double quotes make sure that escape sequences are
converted. If you then put double backslashes, they are converted to
single backslashes, but they do then not escape the next character.

Carlo

···

Subject: string -- double interpretion
  Date: sab 22 ott 16 09:35:25 +0200

--
  * Se la Strada e la sua Virtu' non fossero state messe da parte,
* K * Carlo E. Prelz - fluido@fluido.as che bisogno ci sarebbe
  * di parlare tanto di amore e di rettitudine? (Chuang-Tzu)

Hi,

We should use " instead of ' to use \u#### in your literal.

x='legend\\u00e4ren Sinnspr\\u00fcchen verf\\u00fchrte'

Here is a sample.

irb(main):001:0> x='legend\\u00e4ren Sinnspr\\u00fcchen verf\\u00fchrte'
=> "legend\\u00e4ren Sinnspr\\u00fcchen verf\\u00fchrte"

irb(main):002:0> y="legend\u00e4ren Sinnspr\u00fcchen verf\u00fchrte"
=> "legendären Sinnsprüchen verführte"

Regards,
Toshi

···

On 2016/10/23 4:35, Die Optimisten wrote:

There's a ticket for String unescape/undump on the bug tracker:

  Feature #12275: String unescape - Ruby master - Ruby Issue Tracking System

It has also some links that might help.

Regards,
Marcus

···

Am 22.10.2016 um 21:35 schrieb Die Optimisten:

How do I "evaluate" the \\special letters?
    x='legend\\u00e4ren Sinnspr\\u00fcchen verf\\u00fchrte'

--
GitHub: stomar (Marcus Stollsteimer) · GitHub
PGP: 0x6B3A101A

Hi,
the problem is that this var is already defined as is (content from a webpage).

thanks Opti

···

On 2016-10-22 21:41, Toshihiko Ichida wrote:

Hi,

We should use " instead of ' to use \u#### in your literal.

On 2016/10/23 4:35, Die Optimisten wrote:

x='legend\\u00e4ren Sinnspr\\u00fcchen verf\\u00fchrte'

Here is a sample.

irb(main):001:0> x='legend\\u00e4ren Sinnspr\\u00fcchen verf\\u00fchrte'
=> "legend\\u00e4ren Sinnspr\\u00fcchen verf\\u00fchrte"

irb(main):002:0> y="legend\u00e4ren Sinnspr\u00fcchen verf\u00fchrte"
=> "legendären Sinnsprüchen verführte"

Regards,
Toshi