Writing files in Windows in correct enc. for batch scripts

Discussion in 'Ruby' started by Peter John, Jun 21, 2010.

  1. Peter John

    Peter John Guest

    Hi,

    Me again, ruby 1.9.1 and windows 7 x64.

    My ruby program reads a ton of directory structures containing wav
    files, tag metadata and cuesheets. It then goes on to generate (ruby
    and/or batch) scripts that can be used to invoke lame (the mp3 encoder).
    An example line from such a script would be:

    ruby `lame --nohist -q0 -V0 -ms --vbr-new --id3v2-only
    --replaygain-accurate --ta "10cc" --tl "Live In Concert - Volume One"
    --ty "1995" --tn "01/08" --tc "EU1995" --tt "The Wall Street Shuffle"
    "I:/media/Music/Archive/10cc/Live In Concert - EU1993 - Volume One/01
    The Wall Street Shuffle.wav" "10cc/Live In Concert - EU1993 - Volume
    One/01 The Wall Street Shuffle.mp3"`

    If the input wav filename contains a French or German character, lame
    fails saying that the input file does not exist. Seems that lame is not
    getting the correct accent in the input parameters.

    Adding # encoding: utf-8 doesn't help. Changing the batch file encoding
    to windows-1252 when writing it from ruby causes EncodingConversion
    errors in ruby - it breaks on the accented line, saying it cannot
    convert utf-8 \xyz \xyz to windows-1252 (note that inside my ruby
    program, I consistently work with utf-8).

    It seems that in one case (utf-8) windows is misbehaving, and in the
    other case (windows-1252) I cannot find a way to make ruby do what I
    want.

    Tips would be welcome.
    --
    Posted via http://www.ruby-forum.com/.
    Peter John, Jun 21, 2010
    #1
    1. Advertising

  2. Peter John

    Roger Pack Guest


    > Adding # encoding: utf-8 doesn't help. Changing the batch file encoding
    > to windows-1252 when writing it from ruby causes EncodingConversion
    > errors in ruby - it breaks on the accented line, saying it cannot
    > convert utf-8 \xyz \xyz to windows-1252 (note that inside my ruby
    > program, I consistently work with utf-8).


    do the batch files look "right"? Is this an issue with lame?
    You might get some traction by experimenting with
    Encoding.default_external Encoding.default_internal (basically by trying
    to write the batch files by using some other encoding than the one you
    currently are).

    http://en.wikibooks.org/wiki/Ruby_Programming/Reference/Objects/Encoding

    has some helpful links at the bottom.
    --
    Posted via http://www.ruby-forum.com/.
    Roger Pack, Jun 21, 2010
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. PCH

    base64 enc/dec problem

    PCH, Jul 1, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    538
  2. Soefara
    Replies:
    2
    Views:
    4,576
    Soefara
    Feb 11, 2004
  3. Mick
    Replies:
    2
    Views:
    9,491
    Marcin Grunwald
    Feb 23, 2005
  4. mario
    Replies:
    8
    Views:
    542
    mario
    Jan 3, 2008
  5. Replies:
    13
    Views:
    513
    Anno Siegel
    Sep 10, 2007
Loading...

Share This Page