I'm new to ruby and android. I come from a Java background. I'm going
to attempt to create an android/ruby application to interface with my
microcontroller (Adruino Uno). Is this even possible with Ruby? I
recently discovered Ruboto, but not sure if it has the capability to
access the usb/serialport on the android device (mobile phone).
I also found the serialport gem, which I think can be used to access
serialports on my computer, but not sure if it would work on my android
device.
I'm running into a problem trying to read a line of text that has some multibyte
characters gsub is failing. Is there a trick to finding and replacing multibyte
characters?
The multibyte characters look like this in a text editor:
When simple_soft_en = 1, this registerís contents are transmitted to the remote
PHY in DME format.
When I put this into irb, this is what that text looks like:
1.9.3-p194 :001 > theText = "When simple_soft_en = 1, this
register\U+FFC3\U+FFADs contents are transmitted to the remote PHY in DME
format."
=> "When simple_soft_en = 1, this registers contents are transmitted to the
remote PHY in DME format."
You might want to ask on the JRuby list or a Ruboto list (if there is
one). My understanding though is that Ruboto gives you access to most
of the features Java gives you access to in Android. If not, you might
have more luck with Mirah (created by the creator of JRuby), which has
Ruby-like syntax but is static and compiles directly down to Java
bytecode.
···
On Mon, Jan 7, 2013 at 1:18 PM, Scott Macri <lists@ruby-forum.com> wrote:
Hello,
I'm new to ruby and android. I come from a Java background. I'm going
to attempt to create an android/ruby application to interface with my
microcontroller (Adruino Uno). Is this even possible with Ruby? I
recently discovered Ruboto, but not sure if it has the capability to
access the usb/serialport on the android device (mobile phone).
I also found the serialport gem, which I think can be used to access
serialports on my computer, but not sure if it would work on my android
device.
I'm new to ruby and android. I come from a Java background. I'm going
to attempt to create an android/ruby application to interface with my
microcontroller (Adruino Uno). Is this even possible with Ruby? I
recently discovered Ruboto, but not sure if it has the capability to
access the usb/serialport on the android device (mobile phone).
Ruboto gives you access to the complete Android API, so if a Java Android app can access the serial port, so can a Ruboto Android app.
Do you have something like this as the first line of your code?
# encoding: UTF-8
Harry
···
On Tue, Jan 8, 2013 at 7:58 AM, Wayne Brisette <wbrisett@att.net> wrote:
I'm running into a problem trying to read a line of text that has some multibyte
characters gsub is failing. Is there a trick to finding and replacing multibyte
characters?
I'm running into a problem trying to read a line of text that has some
multibyte
characters gsub is failing. Is there a trick to finding and replacing
multibyte
characters?
On Mon, Jan 7, 2013 at 1:18 PM, Scott Macri <lists@ruby-forum.com> > wrote:
device.
Any information is greatly appreciated. Thanks.
You might want to ask on the JRuby list or a Ruboto list (if there is
one). My understanding though is that Ruboto gives you access to most
of the features Java gives you access to in Android. If not, you might
have more luck with Mirah (created by the creator of JRuby), which has
Ruby-like syntax but is static and compiles directly down to Java
bytecode.
I have added this but when I do, I end up with
'gsub!: Invalid byte sequence in UTF-8 (ArgumentError).
Ironically if I use macruby's irb, I can do the gsub without any problems.
Why would macruby allow this, but not the MRI version of Ruby?
Wayne
···
On Jan 8, 2013, at 1:13 AM, Harry Kakueki wrote:
On Tue, Jan 8, 2013 at 7:58 AM, Wayne Brisette <wbrisett@att.net> wrote:
I'm running into a problem trying to read a line of text that has some multibyte
characters gsub is failing. Is there a trick to finding and replacing multibyte
characters?
Do you have something like this as the first line of your code?
I did have to open the problem file in a hex editor to verify the hex character that was causing issues, but forcing the encoding in the MRI seemed to do the trick.
I wonder why macruby didn't have this sort of issue though.
It isn't. But in the mailing list, these were 2 separate threads.
In ruby-forum it looks like they got mixed together.
Harry
···
On Thu, Jan 10, 2013 at 2:48 AM, Scott Macri <lists@ruby-forum.com> wrote:
How is this relevant to my post?
Wayne Brisette wrote in post #1091375:
I'm running into a problem trying to read a line of text that has some
multibyte
characters gsub is failing. Is there a trick to finding and replacing
multibyte
characters?