If an event’s content includes emojis, something doesn’t work right when generating the event’s id.
Here’s some test code that when run against a working relay will reject the event with a “bad id” error message.
<?php
require './vendor/autoload.php';
use swentel\nostr\Event\Event;
use swentel\nostr\Message\EventMessage;
use swentel\nostr\Relay\Relay;
use swentel\nostr\Sign\Sign;
function send($message) {
$note = new Event();
$note->setContent($message)->setKind(1);
$signer = new Sign();
$signer->signEvent($note, 'some_private_key');
$eventMessage = new EventMessage($note);
$websocket = 'wss://some.nostr.relay';
$relay = new Relay($websocket, $eventMessage);
$result = $relay->send();
if ($result->isSuccess()) {
print "Sent to Nostr!\n";
} else {
print 'Something went wrong: ' . $result->message() . "\n";
}
}
$message = 'This note is a test of emojis 🍕.';
send($message);
The same issue occurs if the content includes a unicode character such as: ñ.
If an event’s content includes emojis, something doesn’t work right when generating the event’s id.
Here’s some test code that when run against a working relay will reject the event with a “bad id” error message.
The same issue occurs if the content includes a unicode character such as: ñ.