How to allow special character in username? Is there any way to allow the special character in username like "#" and "~"?
You have to override the defualt user_validate_name($name) : 

Verify the syntax of the given name.


To do that, define your username validation code in your custom module 

function MODULENAME_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  if ($form_id == 'user_register') {      
    $form['#validate'] = array();
    $form['#validate'][] = 'registration_username_validate';

  }
}


And inside registration_username_validate function do your logic to allow your special characters.

Care about security issues caused by allowing special chars in username and about display issues not sanitized usernames may cause in themes.