It is currently July 23rd, 2018, 11:56 am


All times are UTC




Post new topic Reply to topic  [ 15 posts ] 
Author Message
 Post subject: Allowing chars
PostPosted: February 20th, 2012, 3:43 pm 

Joined: May 26th, 2011, 2:15 pm
Posts: 279
Hey.

I just got a couple of questions.
Is it safe to allow characters like æøå and & in the chat?
If so, where in the code is this written?

Thanks,

~BobKare


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Allowing chars
PostPosted: February 20th, 2012, 5:02 pm 
fCraft Developer
User avatar

Joined: May 21st, 2011, 10:53 pm
Posts: 1386
You will not be able to allow such characters, because Minecraft client does not support extended ASCII or Unicode.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Allowing chars
PostPosted: February 20th, 2012, 5:03 pm 
User avatar

Joined: October 20th, 2011, 9:20 am
Posts: 220
Location: Subnet
I believe those are not accepted by the client software, fCraft would be able to handle them, but I'm not sure if the Notchian clients will. Most of the time, unknown characters will choke the client causing a horrible, slow death, I wouldn't experiment with strange characters on public servers if I were you.

if you really want to push this through, look for the function "ContainsValidCharacters" or "IsValidName" or something similar, it'll eventually lead you to where the characters are evaluated.

_________________
A = {x ∈ P(U) | x ∉ x}

Show
Mods:
  1. /Su - Allows players to temporarily become a different rank
  2. /Snap - Like /Line but only draws straight or diagonal lines.
  3. pre-0.630 skip/none block


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Allowing chars
PostPosted: February 20th, 2012, 5:52 pm 
SupOP

Joined: June 24th, 2011, 10:27 pm
Posts: 314
If a message ends with & and no number after it I believe it will crash every client that receives it.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Allowing chars
PostPosted: February 20th, 2012, 5:55 pm 

Joined: May 26th, 2011, 2:15 pm
Posts: 279
Thanks.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Allowing chars
PostPosted: February 20th, 2012, 5:58 pm 
fCraft Developer
User avatar

Joined: May 21st, 2011, 10:53 pm
Posts: 1386
You dont need to worry about message contents if you use Player.Message(). fCraft will take care of line-wrapping and potential crashing for you. Output sanitizing and wrapping is done in fCraft.LineWrapper class (fCraft/Networking/LineWrapper.cs)


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Allowing chars
PostPosted: February 22nd, 2012, 1:31 pm 

Joined: August 21st, 2011, 6:31 am
Posts: 280
Location: United Kingdom
How do we get all these to work Frag?

Image

My past attempts always return with a '?'

_________________
You cannot use certain BBCodes: [img].


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Allowing chars
PostPosted: February 22nd, 2012, 1:35 pm 
Trustee
User avatar

Joined: May 24th, 2011, 5:51 am
Posts: 1148
fragmer wrote:
You will not be able to allow such characters, because Minecraft client does not support extended ASCII or Unicode.

_________________
McLaughlinKid wrote:
You put roar on everything don't you?


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Allowing chars
PostPosted: February 22nd, 2012, 1:37 pm 
User avatar

Joined: May 25th, 2011, 4:00 pm
Posts: 381
Location: #fCraft
Jonty800 wrote:
How do we get all these to work Frag?

Image

My past attempts always return with a '?'


I saw that on some servers, that can be done... Don't know how.

_________________
Life is a endless pleasure!


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Allowing chars
PostPosted: February 22nd, 2012, 1:39 pm 

Joined: August 21st, 2011, 6:31 am
Posts: 280
Location: United Kingdom
Yeah, mcforge has this, and it is possible.

Fragmer told me a way about half a year ago, but I've totally forgotten.

_________________
You cannot use certain BBCodes: [img].


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Allowing chars
PostPosted: February 22nd, 2012, 2:23 pm 
fCraft Developer
User avatar

Joined: May 21st, 2011, 10:53 pm
Posts: 1386
Minecraft client is capable of showing most code page 437 characters, but the client is not capable of typing any of them in. Minecraft is still unable to show any Unicode. There used to be some random client crash issues if, for example, a line of text contains no printable characters. I never bothered figuring out exact conditions that cause such client crashes.

If you'd like to modify the set of characters that fCraft allows in the output, you'll have to dive into LineWrapper.cs


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Allowing chars
PostPosted: February 23rd, 2012, 1:05 am 

Joined: August 21st, 2011, 6:31 am
Posts: 280
Location: United Kingdom
Thanks for the help Fragmer. :)

I made some changes to the LineWrapper, and I used a simple rawMessage = rawMessage.Replace("(smile)", encoding.GetString(chars)); to replace text with the byte. But I can't seem to get the emotes to come up on the chat feed, they're blank. The bytes definitely get sent because they can be copied from console and appear as an emote when pasted into the WoM chat bar (but obviously don't send when pressing enter because minecraft doesnt support them).

Is there some sort of hidden check that replaces invalid bytes with ' ' ?
Do you have any suggestions on how I can fix this problem?

_________________
You cannot use certain BBCodes: [img].


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Allowing chars
PostPosted: February 23rd, 2012, 1:58 am 
fCraft Developer
User avatar

Joined: May 21st, 2011, 10:53 pm
Posts: 1386
Like I said, the client is very buggy when it comes to showing those non-standard characters. You may have to experiment a bit to get them to work. Maybe they have to be preceded by some code? I seem to vaguely recall those nonprintable characters requiring the null ('\0' or (char)0) somewhere in the string.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Allowing chars
PostPosted: September 7th, 2012, 10:31 am 

Joined: August 21st, 2011, 6:31 am
Posts: 280
Location: United Kingdom
Ahh memories.

I figured this out, if anyone would like a tutorial, feel free to PM me.

_________________
You cannot use certain BBCodes: [img].


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Allowing chars
PostPosted: September 7th, 2012, 8:45 pm 
User avatar

Joined: October 20th, 2011, 9:20 am
Posts: 220
Location: Subnet
fragmer, suggestion: Use those fancy box drawing chars to create awesome/retro menus.

_________________
A = {x ∈ P(U) | x ∉ x}

Show
Mods:
  1. /Su - Allows players to temporarily become a different rank
  2. /Snap - Like /Line but only draws straight or diagonal lines.
  3. pre-0.630 skip/none block


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net