Skip to content
This repository has been archived by the owner on May 16, 2019. It is now read-only.

Chat messages with UTF8 non-ascii chars are not delivered #346

Closed
grigio opened this issue Apr 8, 2016 · 5 comments
Closed

Chat messages with UTF8 non-ascii chars are not delivered #346

grigio opened this issue Apr 8, 2016 · 5 comments

Comments

@grigio
Copy link
Contributor

grigio commented Apr 8, 2016

Brief Description:

Operating System (OS and version): ubuntu 14.04 inside docker
OpenBazaar version: 1.1
Hardware: n/a

Reproducible: Always

Steps to reproduce:

  1. send a message with "ciao à© ® ™ • ½ ¼ ¾ ⅓ ⅔ † ‡ µ ¢ £ € « » ♤ ♧ ♥ ♢"
  2. it is visible locally but never delivered

Observed Behavior:
nothing happens

Expected Behavior:
message delivered to the other user

Additional info (links, images, etc go here):
screenshot 2016-04-08 17 05 55

Between ( ) there should be a message with ut8 chars

@Stemby
Copy link

Stemby commented Apr 9, 2016

I found the same problem also in discussions related to orders (the "Discussion" tab in "Order details").

The real big problem is that sender doesn't get any error, so he can't imagine the message is lost.

I consider this bug VERY serious: languages like French, German, Spanish, Italian, etc., use lots of non-ASCII characters.

@grigio
Copy link
Contributor Author

grigio commented Apr 9, 2016

it could be related to #244 Apparently the message is sent but the receiver don't get it

@Stemby
Copy link

Stemby commented Apr 16, 2016

This issue might be related to #307 too.

@grigio
Copy link
Contributor Author

grigio commented Apr 22, 2016

This is the error i get in the logs:

Traceback (most recent call last):
  File "/OpenBazaar-Server/api/ws.py", line 320, in dataReceived
    request_json["request"]["public_key"])
  File "/OpenBazaar-Server/api/ws.py", line 238, in send_message
    self.factory.kserver.resolve(unhexlify(guid)).addCallback(send)
  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 317, in addCallback
    callbackKeywords=kw)
  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 306, in addCallbacks
    self._runCallbacks()
--- <exception caught here> ---
  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 588, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/OpenBazaar-Server/api/ws.py", line 237, in send
    store_only=True if node_to_send is None else False)
  File "/OpenBazaar-Server/market/network.py", line 490, in send_message
    p.message = str(message)
exceptions.UnicodeEncodeError: 'ascii' codec can't encode character u'\xe0' in position 0: ordinal not in range(128)
2016-04-22 04:20:17-0400 [-] Unhandled Error
        Traceback (most recent call last):
          File "/OpenBazaar-Server/api/ws.py", line 320, in dataReceived
            request_json["request"]["public_key"])
          File "/OpenBazaar-Server/api/ws.py", line 238, in send_message
            self.factory.kserver.resolve(unhexlify(guid)).addCallback(send)
          File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 317, in addCallback
            callbackKeywords=kw)
          File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 306, in addCallbacks
            self._runCallbacks()
        --- <exception caught here> ---
          File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 588, in _runCallbacks
            current.result = callback(current.result, *args, **kw)
          File "/OpenBazaar-Server/api/ws.py", line 237, in send
            store_only=True if node_to_send is None else False)
          File "/OpenBazaar-Server/market/network.py", line 490, in send_message
            p.message = str(message)
        exceptions.UnicodeEncodeError: 'ascii' codec can't encode character u'\xe0' in position 0: ordinal not in range(128)


@another-wes
Copy link

Could line 567 of datastore.py be contributing to the problem?

msgID = digest(message + str(timestamp)).encode("hex") if msg_id is None else msg_id

What is the purpose of encoding the message + timestamp in hex?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants