Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

findHTTPHeaderEncoding

Find the encoding of the HTTP response from the HTTP header


Description

This function is currently made available so it can be called from C code to find the charset from the HTTP header in the response from an HTTP server. It maps this charset value to one of the known R encodings (UTF-8 or LATIN1) or returns the native encoding.

This will most likely be removed in the future.

Usage

findHTTPHeaderEncoding(str)

Arguments

str

one or more lines from the HTTP header

Value

NA or an integer value indicating the encoding to be used. This integer corresponds to the cetype_t enumeration in Rinternals.h.

Author(s)

Duncan Temple Lang

References

Writing R Extensions Manual and the section(s) on character encodings

Examples

findHTTPHeaderEncoding("Content-Type: text/html;charset=ISO-8859-1\r\n")
findHTTPHeaderEncoding("Content-Type: text/html; charset=utf-8\r\n")

RCurl

General Network (HTTP/FTP/...) Client Interface for R

v1.98-1.3
BSD_3_clause + file LICENSE
Authors
CRAN Team [ctb, cre] (de facto maintainer since 2013), Duncan Temple Lang [aut] (<https://orcid.org/0000-0003-0159-1546>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.