-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for reading UTF-8 strings #78
Comments
I've just done this for now: C_BYTES = (0..65535).inject(""){|string, c| string << c rescue RangeError; string}.freeze Not really a solution, but enough so I can continue testing. |
Unfortunately, X12 does not support UTF-8. The specification lists the set of allowed characters which is If you're constructing a X12 document to send to someone, you may have to transcode your UTF-8 to the limited character set. I would be surprised if extending |
I'm trying to think through how it would work, but one thing that might cause trouble is From what I can work out, the So to summarize Next, If you notice that happening, then you might look at |
@kputnam Thanks very much for the detailed reply! If X12 does not support UTF-8, then I think that's enough to convince me to not use it. Actually our partner asked us if we could send it in non-UTF-8 characters so I think we'll have to do that. Now just have to think of a way to map UTF-8 (Japanese) addresses into corresponding English addresses... which is a slightly different problem. |
Good luck! |
For anybody who encounters this problem, geocoder is your friend: result = Geocoder.search("東京都武蔵野市吉祥寺本町二丁目5番10号 いちご吉祥寺ビル").first
result.address
=> "2 Chome-5-10 Kichijōji Honchō, Musashino-shi, Tōkyō-to 180-0004, Japan" |
It seems that stupidedi does not support UTF-8 chacaters when reading out an EDI. I get:
Digging a bit I found that
Stupidedi::Reader::C_BYTES
, defined here, only includes ASCII characters and crashes here when other characters are used.I believe this should be fixable simply by changing the definition of
C_BYTES
but wondering if there are other considerations that would prevent this from being possible.The text was updated successfully, but these errors were encountered: