Convert Text to Full-Width Unicode

Problem

Let's say you're a vaporwave fan and you want to convert your favorite text to full-width unicode (aka. the aesthetic font). Well, fire up the terminal and let it rip! In case you're not familiar with vaporwave, here's a video primer...



Solution in Python

import sys

WIDE_MAP = dict((i, i + 0xFEE0) for i in range(0x21, 0x7F))
WIDE_MAP[0x20]=0x3000

def widen(s):
    return str(s).translate(WIDE_MAP)

print(widen("hello, world!!!")) # hello, world!!!


Solution in Golang

package main

import (
    "fmt"

    "golang.org/x/text/width"
)

func main() {
    fmt.Println(widen("hello, world!!!"))
}

func widen(s string) string {
    return width.Widen.String(s)
}


Live Demo





And vaporwave will show here...