mozzarella has quit [Remote host closed the connection]
mozzarella has joined #ruby
mozzarella has quit [Remote host closed the connection]
jottr has joined #ruby
jottr has quit [Ping timeout: 244 seconds]
Alison` has quit [Quit: Leaving]
Alison` has joined #ruby
dsmythe has joined #ruby
schleppel has joined #ruby
DmitryBochkarev has joined #ruby
cd has joined #ruby
mozzarella has joined #ruby
Swyper has quit [Remote host closed the connection]
Deesl has joined #ruby
Deesl has quit [Client Quit]
fphilipe has joined #ruby
bambanx has quit [Quit: Leaving]
kapil____ has joined #ruby
nadir has quit [Quit: Connection closed for inactivity]
duderonomy has joined #ruby
duckpupp- has joined #ruby
conta has joined #ruby
wallace_mu has joined #ruby
duckpuppy has quit [Ping timeout: 244 seconds]
lomex has joined #ruby
conta has quit [Client Quit]
wallace_mu has quit [Ping timeout: 246 seconds]
conta has joined #ruby
conta has quit [Quit: conta]
mangold has quit [Quit: This computer has gone to sleep]
bokwoon has joined #ruby
wallace_mu has joined #ruby
jefffrails35 has joined #ruby
wallace_mu has quit [Ping timeout: 245 seconds]
lomex has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hightower3 has joined #ruby
phaul has quit [Quit: :wq]
vrih has joined #ruby
sameerynho has joined #ruby
lomex has joined #ruby
fphilipe has quit [Ping timeout: 257 seconds]
vrih has quit [Ping timeout: 246 seconds]
reber has joined #ruby
Dbugger has joined #ruby
kyrylo has joined #ruby
fphilipe has joined #ruby
dhollinger has quit [Read error: Connection reset by peer]
dhollinger has joined #ruby
vrih has joined #ruby
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
clemens3_ has joined #ruby
uranoss has joined #ruby
jefffrails35 has quit [Remote host closed the connection]
nowhere_man has joined #ruby
vrih has quit [Remote host closed the connection]
vrih has joined #ruby
dellavg_ has quit [Ping timeout: 268 seconds]
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
DTZUZO has quit [Ping timeout: 255 seconds]
znz_jp has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
dsmythe has quit [Ping timeout: 250 seconds]
Puffball has joined #ruby
DTZUZO has joined #ruby
DTZUZO has quit [Ping timeout: 268 seconds]
clemens3_ has quit [Ping timeout: 268 seconds]
jottr has joined #ruby
Azure has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Azure has joined #ruby
lomex has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
DTZUZO has joined #ruby
layer has joined #ruby
fphilipe has quit [Quit: WeeChat 2.4]
fphilipe has joined #ruby
agent_white has quit [Quit: bbl]
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
hightower3 has quit [Changing host]
hightower3 has joined #ruby
Fernando-Basso has joined #ruby
_whitelogger has joined #ruby
jottr has quit [Ping timeout: 246 seconds]
vrih has quit [Ping timeout: 246 seconds]
AJA4350 has joined #ruby
al2o3-cr has quit [Quit: If the universe is a machine where the future is uniquely determined by its present state, it would not be possible to calculate what the future will be.]
ricekrispie2 has joined #ruby
ricekrispie has quit [Ping timeout: 250 seconds]
layer has quit [Remote host closed the connection]
tdy has quit [Ping timeout: 255 seconds]
psmolen has quit [Ping timeout: 245 seconds]
Puffball has quit [Read error: Connection reset by peer]
AKPWD has quit [Ping timeout: 244 seconds]
AKPWD has joined #ruby
al2o3-cr has joined #ruby
fphilipe_ has joined #ruby
psmolen has joined #ruby
fphilipe has quit [Ping timeout: 252 seconds]
fphilipe_ has quit [Ping timeout: 268 seconds]
lomex has joined #ruby
Fernando-Basso has quit [Remote host closed the connection]
<Rakete1111>
and it seems like it's doing the same thing? but I don't really get why one way doesn't work and with the other it works
<Rakete1111>
Or same question but asked differently: It seems like `File.open(filename, 'rb') { |f| f.read }` does something else than `File.read(filename)`?
<adam12>
Rakete1111: Indeed that is kinda odd.
<adam12>
Rakete1111: Does it happen on every file or just random ones?
<Rakete1111>
well only on the files that have a multiple parts. I'll check if I can reproduce in the irb
<Rakete1111>
(because that's when the function is used)
jottr has joined #ruby
<Rakete1111>
yes so the output is different
<Rakete1111>
the File.open way gives me a different string than File.read
<adam12>
Rakete1111: That's odd. What OS?
<adam12>
Maybe it's an encoding issue.
russt_ has quit [Ping timeout: 258 seconds]
<Rakete1111>
linux
<Rakete1111>
oh that's true
<adam12>
Rakete1111: The binary flag to File.open does some things different. File.read by default doesn't set binary mode. That might be why you see different results as strings.
<Rakete1111>
oh right, non ascii characters get encoded using \xNN in the first
<Rakete1111>
you're right
<Rakete1111>
so I guess it seems like
<adam12>
Rakete1111: If you're getting what you want with File.read + Mail.new, I don't see any reason why you couldn't use that method.
<Rakete1111>
Mail can't really work with \xNN characters
<Rakete1111>
jup
<adam12>
Rakete1111: It might. I'd look through the spec/fixtures and see if there are any files that match.
<adam12>
Rakete1111: What's your locale, out of curiosity?
DmitryBochkarev has quit [Remote host closed the connection]
<Rakete1111>
It should be en-us, but the email was German
russt has joined #ruby
DmitryBochkarev has joined #ruby
fphilipe_ has joined #ruby
<adam12>
Rakete1111: Might be a mail bug. Hard to say. If you `s = File.read("/path/to/file", mode: "rb"); Mail.new(s).text_part` does it bug out?
agent_white has joined #ruby
<Rakete1111>
So: "\xC3" == "ö" is false. Is there not a way to reverse the conversion that happens when File.read reads a file in binary mode?
<Rakete1111>
yes it does bug out
<Rakete1111>
and the output is the same (so indeed that was it)
<Rakete1111>
Does ruby not have escaped characters in strings?
<adam12>
Rakete1111: The 'b' flag forces external encoding to ASCII-8BIT.
<adam12>
Rakete1111: Do you have a value for `Encoding.default_external` ?
<Rakete1111>
It's #<Encoding:UTF-8>
<adam12>
How about Encoding.default_internal?
<Rakete1111>
nil
<adam12>
Hm. I'd presume that to work just fine.
<adam12>
Should "\xC3" == "ö" be true?
<Rakete1111>
yes. doesn't work even for ASCII characters: "\x30" == "/" is false
<Rakete1111>
nvm
<Rakete1111>
Seems like ruby doesn't know my locale so misinterprets "\xC3" as nothing
<Rakete1111>
and doesn't parse that as character
jottr has quit [Ping timeout: 255 seconds]
<Rakete1111>
I guess that make sense. \xC3 could mean different things in different locales
<Rakete1111>
omg I was wrong
<adam12>
Rakete1111: I don't work too much with different locales so likely getting to the extend of my knowledge here.
<adam12>
Rakete1111: What Ruby version is this?
<Rakete1111>
2.6.2p47
<adam12>
So no issue there.
<Rakete1111>
"\xC3\xB6" == "ö" is true
<Rakete1111>
I didn't see the last part
<adam12>
That looks right.
<Rakete1111>
So why the different? funny
<Rakete1111>
ce*
<Rakete1111>
maybe worth filing a Mail bug I guess
<Rakete1111>
or what do you think?
<adam12>
Rakete1111: Maybe. I'm not sure if the `b` flag is necessary to read emails.
fribmendes has quit [Ping timeout: 258 seconds]
<Rakete1111>
I'll file and see what they think :)
<adam12>
Rakete1111: If you have the source, I'd remove the flag and run the specs. If they all pass, maybe it's a Windows-only thing.
<adam12>
Rakete1111: Could search the issue tracker for encoding. Maybe it's been discussed before.
<Rakete1111>
yeah I will do that thakns
lomex has joined #ruby
bokwoon has quit [Quit: WeeChat 2.5-dev]
hightower3 has quit [Ping timeout: 244 seconds]
houhoulis has joined #ruby
fphilipe_ has quit [Ping timeout: 252 seconds]
Swyper has quit [Remote host closed the connection]
Rakete1111 has quit [Quit: leaving]
fphilipe_ has joined #ruby
DmitryBochkarev has quit [Ping timeout: 255 seconds]
DmitryBochkarev has joined #ruby
suukim has joined #ruby
dviola has joined #ruby
venmx has joined #ruby
houhoulis has quit [Remote host closed the connection]
fphilipe_ has quit [Ping timeout: 258 seconds]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 268 seconds]
AJA4351 is now known as AJA4350
clemens3_ has quit [Ping timeout: 250 seconds]
delimited has joined #ruby
jottr has joined #ruby
hightower3 has joined #ruby
camilasan has quit [Read error: Connection reset by peer]