Skip to main content

All Questions

Tagged with
0 votes
0 answers
87 views

Populate non ascii password in a file using puppet

I am trying to populate a password with non ascii characters into a template file using puppet. I have ecoded password with non ascii to base64 and placed it in hiera-esecrets. When I try to decode ...
jaya's user avatar
  • 1
2 votes
3 answers
145 views

Remove invalid bytes, keep valid UTF-8 (in Ruby 2)

(I posted a similar problem here, but this new question is not a duplicate). Using either Ruby 2.6.10 or 1.9.3 is a requirement that the software I'm developing here must run with these: Small ...
user1934428's user avatar
  • 22.5k
0 votes
2 answers
83 views

Erasing incorrectly encoded byte sequences on reading

I am reading files into Ruby strings, and these strings are later processed further (for instance, using the CSV module). The external encoding of the files is a parameter, and supposedly, the files ...
user1934428's user avatar
  • 22.5k
1 vote
2 answers
93 views

Sanitizing encoding errors on input data in jruby

In my JRuby application, I get input from two sources: External files A Java program, which calls my JRuby code and passes to me data Some of the external data is (supposed) to be encoded as ...
user1934428's user avatar
  • 22.5k
0 votes
0 answers
50 views

Is there any solution for (ActionView::TemplateError) "invalid byte sequence in US-ASCII" error in Ruby 1.9.3?

Recently, I migrated my Ruby apps 1.8.7 to Ruby 1.9.3. After the migration, I am getting an error message called invalid byte sequence in US-ASCII. Many of them are solved by putting #encoding: utf-8 ...
Md Shafayet Jamil's user avatar
0 votes
2 answers
303 views

In ruby, optparse raises error when filename contains certain characters

I'm using optparse in a ruby program (ruby 2.7.1p83) under Linux. If any of the command-line arguments are filenames with "special" characters in them, the parse! method fails with this ...
HippoMan's user avatar
  • 2,340
2 votes
1 answer
76 views

What 's the reason of Ruby IO stream in Windows powershell file type encoding

I have a strangeness problem. In Windows7 operation system,I try to run the command in powershell. ruby -E UTF-8 -e "puts 'どうぞよろしくお願いします,Mr Jason'" > test.txt When I read test.txt file: ...
Jason's user avatar
  • 59
1 vote
1 answer
101 views

Ruby IO redirection to a file by using Kernel.puts,How can I ensure that the stored file's encoding type is ANSI or UTF-8

In windows: visual studio code IDE,I wrote the command like: ruby -E UTF-8 -e "puts '汤姆,Welcome to my home'" > test.txt ,then I use the command: ruby -E UTF-8 -e "puts gets" &...
Jason's user avatar
  • 59
0 votes
1 answer
366 views

Rails ActionMailer Quoted Printable Encoding breaks the output

I have this html message that I would like to send using MIME format through a rest api call ( using microsoft send email api ). @message = "<meta http-equiv=\"Content-Type\" ...
Imam's user avatar
  • 1,326
1 vote
1 answer
36 views

Ruby not respecting # encoding specification

Given the following script (it must be in its own file): #!/usr/bin/env ruby # encoding: binary s = "\xe1\xe7\xe6\x07\x00\x01\x00" puts s.encoding The output of this is "UTF-8". ...
Keith Bennett's user avatar
1 vote
3 answers
1k views

Compress a Integer to a Base64 upper/lower case character in Ruby (to make an Encoded Short URL)

I have a member number like "123456" that I want to encode into the shortest string I can for use in a url shortener (without a database). The standard characters A-Z, a-z and 0-9 give me 62 ...
Evolve's user avatar
  • 9,261
1 vote
1 answer
342 views

Convert unicode to characters in a file using Ruby

I have this string in a code.txt file. "class Solution {\u000Apublic:\u000A vector\u003Cvector\u003Cint\u003E\u003E insert(vector\u003Cvector\u003Cint\u003E\u003E\u0026 intervals, vector\...
Imam's user avatar
  • 1,326
2 votes
1 answer
56 views

string length display one character extra - ruby

I am processing a csv file uploaded by users, the csv only has one column with the header row "API" when i process the CSV, for one of the file i see that "API".downcase.length ...
opensource-developer's user avatar
1 vote
1 answer
76 views

Rails .exists? not comparing unicode characters

I have a simple blog-like application where a post can belong to a category. The thing is, my application is in French and one of the categories is "l'épidémie de COVID-19". When I check if ...
sam's user avatar
  • 253
0 votes
1 answer
371 views

Can't get Ruby to accept UTF-8 input

I had this very problem since several version of Ruby ago, and I even changed both computer and OS in the meanwhile. Still, I can't get through it at all. The point is that now I'm using Ruby to ...
il mietitore's user avatar

15 30 50 per page
1
2 3 4 5
45