Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 7 of 7 for encoderFunc (0.22 sec)

  1. src/unicode/utf16/utf16.go

    		return (r1-surr1)<<10 | (r2 - surr2) + surrSelf
    	}
    	return replacementChar
    }
    
    // EncodeRune returns the UTF-16 surrogate pair r1, r2 for the given rune.
    // If the rune is not a valid Unicode code point or does not need encoding,
    // EncodeRune returns U+FFFD, U+FFFD.
    func EncodeRune(r rune) (r1, r2 rune) {
    	if r < surrSelf || r > maxRune {
    		return replacementChar, replacementChar
    	}
    	r -= surrSelf
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 07 19:08:48 UTC 2024
    - 3.9K bytes
    - Viewed (0)
  2. src/unicode/utf16/utf16_test.go

    	for i, tt := range encodeTests {
    		j := 0
    		for _, r := range tt.in {
    			r1, r2 := EncodeRune(r)
    			if r < 0x10000 || r > unicode.MaxRune {
    				if j >= len(tt.out) {
    					t.Errorf("#%d: ran out of tt.out", i)
    					break
    				}
    				if r1 != unicode.ReplacementChar || r2 != unicode.ReplacementChar {
    					t.Errorf("EncodeRune(%#x) = %#x, %#x; want 0xfffd, 0xfffd", r, r1, r2)
    				}
    				j++
    			} else {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 07 19:08:48 UTC 2024
    - 6.5K bytes
    - Viewed (0)
  3. src/html/escape.go

    		// No-op.
    	} else if x := entity[string(entityName)]; x != 0 {
    		return dst + utf8.EncodeRune(b[dst:], x), src + i
    	} else if x := entity2[string(entityName)]; x[0] != 0 {
    		dst1 := dst + utf8.EncodeRune(b[dst:], x[0])
    		return dst1 + utf8.EncodeRune(b[dst1:], x[1]), src + i
    	} else if !attribute {
    		maxLen := len(entityName) - 1
    		if maxLen > longestEntityWithoutSemicolon {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jan 13 07:00:18 UTC 2020
    - 5K bytes
    - Viewed (0)
  4. src/unicode/utf8/example_test.go

    	}
    	// Output:
    	// H 1
    	// e 1
    	// l 1
    	// l 1
    	// o 1
    	// , 1
    	//   1
    	// 世 3
    	// 界 3
    }
    
    func ExampleEncodeRune() {
    	r := '世'
    	buf := make([]byte, 3)
    
    	n := utf8.EncodeRune(buf, r)
    
    	fmt.Println(buf)
    	fmt.Println(n)
    	// Output:
    	// [228 184 150]
    	// 3
    }
    
    func ExampleEncodeRune_outOfRange() {
    	runes := []rune{
    		// Less than 0, out of range.
    		-1,
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Nov 05 21:29:18 UTC 2021
    - 3.6K bytes
    - Viewed (0)
  5. src/runtime/utf8.go

    			pos += 4
    			if rune3Max < r && r <= maxRune {
    				return
    			}
    		}
    	}
    
    	return runeError, k + 1
    }
    
    // encoderune writes into p (which must be large enough) the UTF-8 encoding of the rune.
    // It returns the number of bytes written.
    func encoderune(p []byte, r rune) int {
    	// Negative values are erroneous. Making it unsigned addresses the problem.
    	switch i := uint32(r); {
    	case i <= rune1Max:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jan 06 02:46:02 UTC 2020
    - 3.4K bytes
    - Viewed (0)
  6. src/html/template/css.go

    			//   unicode ::= '\' [0-9a-fA-F]{1,6} wc?
    			j := 2
    			for j < len(s) && j < 7 && isHex(s[j]) {
    				j++
    			}
    			r := hexDecode(s[1:j])
    			if r > unicode.MaxRune {
    				r, j = r/16, j-1
    			}
    			n := utf8.EncodeRune(b[len(b):cap(b)], r)
    			// The optional space at the end allows a hex
    			// sequence to be followed by a literal hex.
    			// string(decodeCSS([]byte(`\A B`))) == "\nB"
    			b, s = b[:len(b)+n], skipCSSSpace(s[j:])
    		} else {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 02 19:38:18 UTC 2023
    - 7K bytes
    - Viewed (0)
  7. src/vendor/golang.org/x/text/unicode/bidi/prop.go

    	0x8: FSI, // U+2068 FirstStrongIsolate,
    	0x9: PDI, // U+2069 PopDirectionalIsolate,
    }
    
    // LookupRune returns properties for r.
    func LookupRune(r rune) (p Properties, size int) {
    	var buf [4]byte
    	n := utf8.EncodeRune(buf[:], r)
    	return Lookup(buf[:n])
    }
    
    // TODO: these lookup methods are based on the generated trie code. The returned
    // sizes have slightly different semantics from the generated code, in that it
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 11 20:28:54 UTC 2019
    - 5.7K bytes
    - Viewed (0)
Back to top