charset.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 #include "squid.h"
10 #include "charset.h"
11 
13 char *
14 latin1_to_utf8(char *out, size_t size, const char *in)
15 {
16  unsigned char *p = (unsigned char *)out;
17  for (; *in && size > 2; in++) {
18  unsigned char ch = (unsigned char)*in;
19  if (ch < 0x80) {
20  *p++ = ch;
21  size--;
22  } else {
23  *p++ = (ch >> 6) | 0xc0;
24  size--;
25  *p++ = (ch & 0x3f) | 0x80;
26  size--;
27  }
28  }
29  *p = '\0';
30  if (*in)
31  return NULL;
32  return out;
33 }
34 
char * p
Definition: membanger.c:43
char * latin1_to_utf8(char *out, size_t size, const char *in)
Definition: charset.c:14
#define NULL
Definition: types.h:166
int size
Definition: ModDevPoll.cc:77

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors