NNostr icon indicating copy to clipboard operation
NNostr copied to clipboard

I can't post a new line

Open betonetojp opened this issue 1 year ago • 3 comments

Or rather, I cannot post '\'

betonetojp avatar Apr 12 '24 23:04 betonetojp

Can you please provide a full example?

Kukks avatar Apr 16 '24 08:04 Kukks

See the following code https://github.com/betonetojp/nokakoi/blob/4db437d80928de4feb19f00dcdbdeaab438e8db8/nokakoi/FormMain.cs#L509

I cannot post when textBoxPost.Text = "hello\nworld".

betonetojp avatar Apr 16 '24 12:04 betonetojp

I'm sure there's a better solution, but adding

payload = payload.Replace("\\\\n", "\\n");

after this line https://github.com/Kukks/NNostr/blob/46e80c12ad90afff7b8606d155adbf3b614dbea1/NNostr.Client/NostrClient.cs#L192 allowed me to post a new line.

betonetojp avatar Apr 28 '24 19:04 betonetojp

"\n" is not a newline character. the ASCII code for a newline (line feed) character is 10. If you want a new line, you should use the actual character for it, not the text "\n". Or use a multi-line control on your form, so you can just press the enter key to get new lines. Or, if you want to type "\n" in your textbox, but replace it with a newline character, use: Content = textBoxPost.Text.Replace("\\n", "\n");

remcoros avatar Jun 06 '24 21:06 remcoros

Version 0.0.49 seems to fix it. thx.

betonetojp avatar Jun 07 '24 19:06 betonetojp