# package utf16
`import "unicode/utf16"`
utf16包实现了UTF-16序列的编解码。
## Index
* [func IsSurrogate(r rune) bool](#IsSurrogate)
* [func DecodeRune(r1, r2 rune) rune](#DecodeRune)
* [func Decode(s []uint16) []rune](#Decode)
* [func EncodeRune(r rune) (r1, r2 rune)](#EncodeRune)
* [func Encode(s []rune) []uint16](#Encode)
## func [IsSurrogate](https://github.com/golang/go/blob/master/src/unicode/utf16/utf16.go#L30 "View Source")
```
func IsSurrogate(r rune) bool
```
返回r是否可以编码为一个utf-16的代理对。
## func [DecodeRune](https://github.com/golang/go/blob/master/src/unicode/utf16/utf16.go#L37 "View Source")
```
func DecodeRune(r1, r2 rune) rune
```
将utf-16代理对(r1, r2)解码为unicode码值。如果代理对不合法,会返回U+FFFD。
## func [Decode](https://github.com/golang/go/blob/master/src/unicode/utf16/utf16.go#L86 "View Source")
```
func Decode(s []uint16) []rune
```
将utf-16序列解码为unicode码值序列。
## func [EncodeRune](https://github.com/golang/go/blob/master/src/unicode/utf16/utf16.go#L47 "View Source")
```
func EncodeRune(r rune) (r1, r2 rune)
```
将unicode码值r编码为一个utf-16的代理对。如果不能编码,会返回(U+FFFD, U+FFFD)。
## func [Encode](https://github.com/golang/go/blob/master/src/unicode/utf16/utf16.go#L56 "View Source")
```
func Encode(s []rune) []uint16
```
将unicode码值序列编码为utf-16序列。
- 库
- package achive
- package tar
- package zip
- package bufio
- package builtin
- package bytes
- package compress
- package bzip2
- package flate
- package gzip
- package lzw
- package zlib
- package container
- package heap
- package list
- package ring
- package crypto
- package aes
- package cipher
- package des
- package dsa
- package ecdsa
- package elliptic
- package hmac
- package md5
- package rand
- package rc4
- package rsa
- package sha1
- package sha256
- package sha512
- package subtle
- package tls
- package x509
- package pkix
- package database
- package sql
- package driver
- package encoding
- package ascii85
- package asn1
- package base32
- package base64
- package binary
- package csv
- package gob
- package hex
- package json
- package pem
- package xml
- package errors
- package expvar
- package flag
- package fmt
- package go
- package doc
- package format
- package parser
- package printer
- package hash
- package adler32
- package crc32
- package crc64
- package fnv
- package html
- package template
- package image
- package color
- package palette
- package draw
- package gif
- package jpeg
- package png
- package index
- package suffixarray
- package io
- package ioutil
- package log
- package syslog
- package math
- package big
- package cmplx
- package rand
- package mime
- package multipart
- package net
- package http
- package cgi
- package cookiejar
- package fcgi
- package httptest
- package httputil
- package pprof
- package mail
- package rpc
- package jsonrpc
- package smtp
- package textproto
- package url
- package os
- package exec
- package signal
- package user
- package path
- package filepath
- package reflect
- package regexp
- package runtime
- package cgo
- package debug
- package pprof
- package race
- package sort
- package strconv
- package strings
- package sync
- package atomic
- package text
- package scanner
- package tabwriter
- package template
- package time
- package unicode
- package utf16
- package utf8
- package unsafe