Note that there are some explanatory texts on larger screens.

plurals
  1. POEncoding Problem when filling out a text_field with Watir in Ruby
    primarykey
    data
    text
    <p>I'm using Watir to fill out a text_field with the html-code that I have scraped with another program before.</p> <p>The language of the website-content that I'm transfering is German, so there are some special characters involved, that don't exist in the English alphabet.</p> <p>Those characters are displayed properly in the html-file, but when transfered into the text_field of the Joomla installation (I'm transfering a website to Joomla with this program), the special characters are not displayed properly.</p> <p>As the result of a users great help, I have been able to solve a previous problem and am now transfering the content with the following method:</p> <pre><code>browser.text_field(:id =&gt; "text").value=(open('my-site.html') { |f| f.read }) </code></pre> <p>The result was, that the special characters were shown as follows:</p> <pre><code>über =&gt; ³ber vergißt =&gt; vergi▀t wählen =&gt; wõhlen geförderter =&gt; gef÷rderter </code></pre> <p>The user guessed that it had something to do with the codepage that I'm on and encoding issues. Running DOS: chcp resulted in the output of 850.</p> <p>His attempt to solve the problem was the following:</p> <pre><code>require 'iconv' browser.text_field(:id =&gt; "text").value=( Iconv.iconv('CP850', 'ISO-8859-1', open('my-site.html') { |f| f.read }) ) </code></pre> <p>Unfortunately, this didn't solve the problem and the special characters are now shown for example as: \x81ber = über vergi\xE1t = vergißt and new lines are shown as \n</p> <p>I scraped the pages with the Mechanize, using the following code:</p> <pre><code>auszug=page.search ('/html/body/table/tr/td/table/tr[2]/td/table/tr/td[4]') outputFile&lt;&lt;auszug </code></pre> <p>I hope you can somehow help me, as I'm just a volunteer working here with a bit of programming experience. If I don't get this program running by next week (this encoding thing is the only thing that's really stopping me), then I'll have to manually transfer a hundred pages using copy+paste :/</p> <p>Thanks for taking the time and all the effort you're putting into this! :-)</p> <p>Sebastian</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload