1// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "encodings/compact_lang_det/win/cld_htmlutils.h"
6
7// Src points to '&'
8// Writes entity value to dst. Returns take(src), put(dst) byte counts
9void EntityToBuffer(const char* src, int len, char* dst,
10                    int* tlen, int* plen) {
11  // On Windows we do not have to do anything, browser expands HTML entities
12  // for us, so text we're retrieving from it is ready for translation as it is.
13  // But:
14
15  // This is a temporary solution to let us continue the development without
16  // having a real DOM text scraping in place.  For now the full HTML is fed
17  // to CLD for language detection and just ignoring entities is good enough
18  // for testing.  Later entities will be expanded by browser itself.
19
20  // Skip entity in the source.
21  *tlen = 1;
22  do {
23    ++src;
24    ++*tlen;
25  } while (*src && *src != ';');
26  // Report a bogus entity (space).
27  *dst = ' ';
28  *plen = 1;
29}
30