Cannot run a ruby 1.8.7 web-app with ruby 1.9.3

hi
This is on fedore 17, standard installation.
This web-app run flawlessly with ruby 1.8.7, but i cannot make it run
with ruby 1.9.3. It is a web-mysql-database application.

The following problems:

  1. I cannot make run gettext (the app with ruby 1.8.7 runs in various
    languages)

  2. cgi output is garbled, unusable.

  3. gettext
    I include the gettext library using require “gettext/cgi”
    To control, whether ruby-gettext is installed, I do

[root@myhost ~]# rpm -qa |grep gettext
gettext-0.18.1.1-12.fc17.x86_64
gettext-libs-0.18.1.1-12.fc17.x86_64
rubygem-gettext-2.2.0-2.fc17.noarch
perl-gettext-1.05-24.fc17.x86_64
[root@myhost ~]#

gettext works fine in perl and php, not in ruby.

Because that did not work, I additionally did
[root@myhost ~]# gem install gettext
Fetching: gettext-2.2.1.gem (100%)
Successfully installed gettext-2.2.1
1 gem installed
Installing ri documentation for gettext-2.2.1…
Installing RDoc documentation for gettext-2.2.1…
[root@myhost ~]#
[root@myhost ~]# gem install “gettext/cgi”
ERROR: Could not find a valid gem ‘gettext/cgi’ (>= 0) in any
repository
ERROR: Possible alternatives: gettext
[root@myhost ~]#

To the same issue: gettext does not work.
I thought, I had missed to install an essential library, but could not
find any hint.

What am I missing?

  1. cgi output garbled
    cgi output starts fine, until it comes to the essential: the dispatcher
    of the app. That’s where a " (double-quote) character is inserted into
    the cgi text, which makes, that from then on all parameter values in the
    cgi are escaped with a \ (backslash), unusable for the browser. When the
    dispatcher of the app is finished, again a closing " (double-quote) is
    dropped into the cgi text, and from then on everyghing is fine. But the
    core of the app is unrecognizable by the browser. There are some buttons
    in the app, which are created by a different class, they also are
    correct. Only the part created by the main application is incorrect.

follows the cgi-text created by ruby 1.9.3:

[" \n \n \n \n\n \n\n \n \n
\n\n actual: today's tasks for root -> zurrough results found
\n\n\n\n\n\n\n \n
\n ", nil]

The main part of the app, in ruby, which generates the wrong cgi-text
is:
(NOTE: the actual class is a sub-class of CGIext, which in turn is a
sub-class of the regular CGI class)

h1{@expires}+ "#{ # Dispatcher START [1,2].collect { actix = params["maxipaxi"][0] params["maxipaxi"][0] = "" case actix when "start" ab = ActualBase.new(self, dbx, sess) ab.contentx(params) when "allago" ab = ActualBase.new(dbx) ab.contentx(params) when "nextmonth" ab = ActualBase.new(dbx) ab.contentx(params) when "lastmonth" ab = ActualBase.new(dbx) ab.contentx(params) when "printspecific" ab = ActualPX.new(dbx) ab.contentx(params) when "newentry" ab = ActualNew.new(dbx) ab.contentx(params) when "storenew" ab = ActualStoreNew.new(dbx) ab.contentx(params) when "storechanges" ab = ActualStoreChanges.new(dbx) ab.contentx(params) when "printableversion" ab = ActualPrintable.new(dbx) ab.contentx(params) when "removethis" ab = ActualRemove.new(dbx) ab.contentx(params) when "betweenpopup" ab = ActualBase.new(dbx) ab.contentx(params) when "betweencompute" ab = ActualBase.new(dbx) ab.contentx(params) end }
    }"+  # Dispatcher END
    hidden("name"=>"hislis", "id"=>"hislis",

“value”=>CGI::escapeHTML(params[“hislis”][0]))+"\n"

I was investigating about 4 days what I could have done wrong: no
success. Should I better go back to ruby 1.8.7?

If you need more info, do not hesitate to drop a mail.

Thanks everybody in advance.

suomi

On Fri, Jun 8, 2012 at 2:41 PM, Ruby R. [email protected] wrote:

hi
This is on fedore 17, standard installation.
This web-app run flawlessly with ruby 1.8.7, but i cannot make it run
with ruby 1.9.3. It is a web-mysql-database application.

The following problems:

  1. I cannot make run gettext (the app with ruby 1.8.7 runs in various
    languages)

As far as I can see you only showed how installation of gettext/gci
failed but no error actually using gettext.

  1. cgi output is garbled, unusable.

The output looks pretty reasonable on first sight. What is the
“garbled” part?

A general remark: it may be that you run into an encoding issue.

Kind regards

robert

Robert K. wrote in post #1063702:

On Fri, Jun 8, 2012 at 2:41 PM, Ruby R. [email protected] wrote:

hi
This is on fedore 17, standard installation.
This web-app run flawlessly with ruby 1.8.7, but i cannot make it run
with ruby 1.9.3. It is a web-mysql-database application.

The following problems:

  1. I cannot make run gettext (the app with ruby 1.8.7 runs in various
    languages)

As far as I can see you only showed how installation of gettext/gci
failed but no error actually using gettext.

  1. cgi output is garbled, unusable.

The output looks pretty reasonable on first sight. What is the
“garbled” part?

A general remark: it may be that you run into an encoding issue.
Gray Soft / Not Found

Kind regards

robert

Hi Robert

thanks for the immediate reply.

Problem is with gettext: I just don’t get any Error Message, gettext
just does not do its job, i.e. no conversion at all as if gettext were
not installed.

In the HTML output: did you not see the backslashes in front of the
parameter values?

suomi

Robert K. wrote in post #1063717:

gettext: I will do a simple test case, that’s a good idea.
command dispatcher: that is an excellent idea, I will follow that.

many thanks, robert, and good weekend

suomi

Ruby R. wrote in post #1063721:

Robert K. wrote in post #1063717:

gettext: I will do a simple test case, that’s a good idea.
command dispatcher: that is an excellent idea, I will follow that.

many thanks, robert, and good weekend

suomi

Hi Robert
after converting the dispatcher as you suggested, the HTML coding is
correct.
Only gettext still fails, i.e. just does nothing.

Again thank you very much

suomi

On Fri, Jun 8, 2012 at 3:16 PM, Ruby R. [email protected] wrote:

As far as I can see you only showed how installation of gettext/gci
failed but no error actually using gettext.

  1. cgi output is garbled, unusable.

The output looks pretty reasonable on first sight. What is the
“garbled” part?

A general remark: it may be that you run into an encoding issue.
Gray Soft / Not Found

Problem is with gettext: I just don’t get any Error Message, gettext
just does not do its job, i.e. no conversion at all as if gettext were
not installed.

Hm, did you create a simple test case to see whether it works at all?
I have zero experience with gettext so I cannot really help much with
that. Could be a changed configuration or whatnot.

In the HTML output: did you not see the backslashes in front of the
parameter values?

Like:

irb(main):001:0> s=“This is a "string".”
=> “This is a "string".”
irb(main):002:0> puts s
This is a “string”.
=> nil
irb(main):003:0> p s
“This is a "string".”
=> “This is a "string".”

? That’s not a bug, that’s the regular output of String#inspect. Are
you maybe using the wrong method to print output?

Btw, your dispatcher code with [1,2].collect{…} looks pretty
inefficient and complex. I’d rather stick all those strings in a Hash
and let them be executed from there.

cmds = {
“start” => lambda {|x_self, dbx, sess, params|
ab = ActualBase.new(x_self, dbx, sess)
ab.contentx(params)
ab
},

}

Cheers

robert