Skip to main content
hhow09's Blog

Character Sets and Encodings

ASCII #

EASCII #

UNICODE #

UTF-8 #

   Char. number range  |        UTF-8 octet sequence
      (hexadecimal)    |              (binary)
   --------------------+------------------------------------
   0000 0000-0000 007F | 0xxxxxxx
   0000 0080-0000 07FF | 110xxxxx 10xxxxxx
   0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx
   0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx

Example #

Base64 #

Example: #

Example - Generate random password #

Language-specific characters are typically avoided by password generators because they would not be universally available (US keyboards don't have accented characters, for instance). So don't take their omission from these tools as an indication that they might be weak or problematic. - Is it bad to use special characters in passwords? [duplicate]

package main
import (
	"crypto/rand"
	"encoding/base64"
	"fmt"
	"log"
)

func main() {
	buf := make([]byte, 32)
	_, err := rand.Read(buf)
	if err != nil {
		log.Fatalf("error while generating random string: %s", err)
	}
	// fmt.Println(string(buf)) // not printable

	printable_password := base64.StdEncoding.EncodeToString(buf)
	fmt.Println("generated password", printable_password)
}

Base64Url #

Usage #

Ref #