aboutsummaryrefslogtreecommitdiff
H. Code for Encoding Conversion Example

H. Code for Encoding Conversion Example

#include <string.h>
#include <libxml/parser.h>


unsigned char*
convert (unsigned char *in, char *encoding)
{
	unsigned char *out;
        int ret,size,out_size,temp;
        xmlCharEncodingHandlerPtr handler;

        size = (int)strlen(in)+1; 
        out_size = size*2-1; 
        out = malloc((size_t)out_size); 

        if (out) {
                handler = xmlFindCharEncodingHandler(encoding);
                
                if (!handler) {
                        free(out);
                        out = NULL;
                }
        }
        if (out) {
                temp=size-1;
                ret = handler->input(out, &out_size, in, &temp);
                if (ret || temp-size+1) {
                        if (ret) {
                                printf("conversion wasn't successful.\n");
                        } else {
                                printf("conversion wasn't successful. converted: %i octets.\n",temp);
                        }
                        free(out);
                        out = NULL;
                } else {
                        out = realloc(out,out_size+1); 
                        out[out_size]=0; /*null terminating out*/
                        
                }
        } else {
                printf("no mem\n");
        }
        return (out);
}	


int
main(int argc, char **argv) {

	unsigned char *content, *out;
	xmlDocPtr doc;
	xmlNodePtr rootnode;
	char *encoding = "ISO-8859-1";
	
		
	if (argc <= 1) {
		printf("Usage: %s content\n", argv[0]);
		return(0);
	}

	content = argv[1];

	out = convert(content, encoding);

	doc = xmlNewDoc ("1.0");
	rootnode = xmlNewDocNode(doc, NULL, (const xmlChar*)"root", out);
	xmlDocSetRootElement(doc, rootnode);

	xmlSaveFormatFileEnc("-", doc, encoding, 1);
	return (1);
}

td>Marius Bakke 2018-05-22gnu: gstreamer: Update to 4.14.1....* gnu/packages/gstreamer.scm (gstreamer, gst-plugins-base, gst-plugins-good) (gst-plugins-bad, gst-plugins-ugly, gst-libav, python-gst): Update to 4.14.1. Mark H Weaver 2018-05-17Merge branch 'master' into core-updatesMark H Weaver 2018-05-12gnu: gst-plugins-ugly: Remove libmad from the build environment....Libmad is not used by gst-plugins-ugly since 1.12.0. * gnu/packages/gstreamer.scm (gst-plugins-ugly)[inputs]: Remove libmad. Leo Famulari 2018-04-30Merge branch 'master' into core-updatesMark H Weaver 2018-04-30Merge branch 'master' into core-updatesMark H Weaver 2018-04-25Merge branch 'master' into stagingMarius Bakke 2018-04-23gnu: gstreamer: Downgrade to 1.12.5....* gnu/packages/gstreamer.scm (gstreamer, gst-plugins-base, gst-plugins-good, gst-plugins-bad, gst-plugins-ugly, gst-libav, python-gst): Downgrade to 1.12.5. Marius Bakke 2018-04-23gnu: ffmpeg: Update to 4.0....* gnu/packages/video.scm (ffmpeg): Update to 4.0. * gnu/packages/video.scm (ffmpeg@3.4): New variable. * gnu/packages/video.scm (ffmpeg-git): Remove variable. * gnu/packages/video.scm (mpv)[inputs]: Build with ffmpeg instead of ffmpeg-git. * gnu/packages/gstreamer.scm (gst-libav)[inputs]: Build with ffmpeg@3.4 instead of ffmpeg. * gnu/packages/messaging.scm (qtox)[inputs]: Build with ffmpeg@3.4 instead of ffmpeg. * gnu/packages/emulators.scm (dolphin-emu)[inputs]: Build with ffmpeg@3.4 instead of ffmpeg. * gnu/packages/gnunet.scm (libextractor)[inputs]: Build with ffmpeg@3.4 instead of ffmpeg. Rutger Helling 2018-04-16Merge branch 'master' into stagingMarius Bakke 2018-04-10Merge branch 'master' into core-updatesMark H Weaver 2018-04-05gnu: python-gst: Update to 1.12.5....* gnu/packages/gstreamer.scm (python-gst): Update to 1.12.5. Tobias Geerinckx-Rice 2018-03-22gnu: gstreamer: Update to 1.14.0....* gnu/packages/gstreamer.scm (gstreamer, gst-plugins-good, gst-plugins-bad, gst-plugins-ugly, gst-libav, python-gst): Update to 1.14.0. (gst-plugins-base): Likewise. [inputs]: Move ORC ... [propagated-inputs]: ... here. Add GLIB. Marius Bakke 2018-03-20gnu: orc: Return #t from all phases....* gnu/packages/gstreamer.scm (orc)[arguments]: Return #t from the 'disable-faulty-test' phase. Mark H Weaver 2018-02-26gnu: Use HTTPS for supported freedesktop.org home pages....* gnu/packages/fontutils.scm (fontconfig)[home-page]: Use HTTPS. * gnu/packages/freedesktop.scm (python-pyxdg, accountsservice) (modem-manager, telepathy-mission-control, telepathy-mission-control) (colord-gtk, desktop-file-utils)[home-page]: Likewise. * gnu/packages/ghostscript.scm (libspectre)[home-page]: Likewise. * gnu/packages/glib.scm (dbus, dbus-glib, telepathy-glib)[home-page]: Likewise. * gnu/packages/gnome.scm (shared-mime-info, hicolor-icon-theme) (libxklavier, colord, upower)[home-page]: Likewise. * gnu/packages/gstreamer.scm (orc, python-gst)[home-page]: Likewise. * gnu/packages/libcanberra.scm (sound-theme-freedesktop)[home-page]: Likewise. * gnu/packages/libreoffice.scm (libexttextcat)[home-page]: Likewise. * gnu/packages/polkit.scm (polkit-gnome, polkit-gnome)[home-page]: Likewise. * gnu/packages/pulseaudio.scm (pavucontrol)[home-page]: Likewise. * gnu/packages/python.scm (python-dbus)[home-page]: Likewise. * gnu/packages/xdisorg.scm (startup-notification)[home-page]: Likewise. Tobias Geerinckx-Rice 2017-12-12gnu: Remove ffmpeg@3.3....The reason this was required was because of a regression in ffmpeg 3.4; see <https://trac.ffmpeg.org/ticket/6775>. * gnu/packages/gstreamer.scm (gst-libav)[inputs]: Change FFMPEG-3.3 to FFMPEG. * gnu/packages/video.scm (ffmpeg-3.3): Remove variable. Marius Bakke 2017-12-10gnu: gstreamer: Update to 1.12.4....* gnu/packages/gstreamer.scm (gstreamer, gst-plugins-base, gst-plugins-good, gst-plugins-ugly, gst-libav, python-gst): Update to 1.12.4. (gst-plugins-bad): Likewise. [arguments]: Remove #:phases. Marius Bakke 2017-12-03gnu: Add gst123....* gnu/packages/gstreamer.scm (gst123): New variable. Ricardo Wurmus 2017-11-21gnu: orc: Update to 0.4.28....* gnu/packages/gstreamer.scm (orc): Update to 0.4.28. Marius Bakke 2017-10-27gnu: Add ffmpeg@3.3 and use it on packages that fail with 3.4....* gnu/packages/gstreamer.scm (gst-libav)[inputs]: Change ffmpeg to ffmpeg-3.3. * gnu/packages/messaging.scm (qtox)[inputs]: Change ffmpeg to ffmpeg-3.3. * gnu/packages/video.scm (ffmpeg-3.3): New variable. Signed-off-by: Marius Bakke <mbakke@fastmail.com> Rutger Helling 2017-10-05gnu: openjpeg: Update to 2.3.0....* gnu/packages/patches/openjpeg-CVE-2017-12982.patch, gnu/packages/patches/openjpeg-CVE-2017-14040.patch, gnu/packages/patches/openjpeg-CVE-2017-14041.patch, gnu/packages/patches/openjpeg-CVE-2017-14151.patch, gnu/packages/patches/openjpeg-CVE-2017-14152.patch, gnu/packages/patches/openjpeg-CVE-2017-14164.patch: Delete files. * gnu/local.mk (dist_patch_DATA): Remove them. * gnu/packages/image.scm (openjpeg): Update to 2.3.0. [source](patches): Remove. * gnu/packages/gstreamer.scm (gst-plugins-bad)[arguments]: Adjust openjpeg substitution. Marius Bakke 2017-09-18gnu: gstreamer: Update to 1.12.3....* gnu/packages/gstreamer.scm (gstreamer, gst-plugins-base, gst-plugins-good, gst-plugins-bad, gst-plugins-ugly, gst-libav, python-gst): Update to 1.12.3. Marius Bakke 2017-08-22gnu: gst-plugins-bad: Build with wayland support....* gnu/packages/gstreamer.scm (gst-plugins-bad)[inputs]: Add wayland. Efraim Flashner 2017-08-10gnu: openjpeg: Update to 2.2.0 [security fixes]....In addition to the patches we already had (which are not mentioned in the ChangeLog, but verified by following their respective GitHub issues) this release also fixes CVE-2016-9112, CVE-2016-5139, CVE-2016-5152, CVE-2016-5158, CVE-2016-5159, CVE-2016-1626 and CVE-2016-1628. See <https://github.com/uclouvain/openjpeg/blob/v2.2.0/CHANGELOG.md> for details. * gnu/packages/patches/openjpeg-CVE-2016-9572-CVE-2016-9573.patch, gnu/packages/patches/openjpeg-CVE-2016-9850-CVE-2016-9851.patch: Delete files. * gnu/local.mk (dist_patch_DATA): Remove them. * gnu/packages/image.scm (openjpeg): Update to 2.2.0. [source](patches): Remove. * gnu/packages/gstreamer.scm (gst-plugins-bad)[arguments]: Add phase to patch hard-coded openjpeg-2.1 path. Marius Bakke 2017-07-31gnu: gst-plugins-good: Update disable-failing-tests phase....* gnu/packages/gstreamer.scm (gst-plugins-good)[arguments]: Change the list of tests to disable during 'disable-failing-tests phase. Efraim Flashner 2017-07-18gnu: orc: Update to 0.4.27....* gnu/packages/gstreamer.scm (orc): Update to 0.4.27. Marius Bakke 2017-07-14gnu: gstreamer: Update to 1.12.2....* gnu/packages/gstreamer.scm (gstreamer, gst-plugins-base, gst-plugins-good, gst-plugins-bad, gst-plugins-ugly, gst-libav, python-gst): Update to 1.12.2. Marius Bakke 2017-06-20gnu: gstreamer: Update to 1.12.1....* gnu/packages/gstreamer.scm (gstreamer, gst-plugins-base, gst-plugins-good, gst-plugins-bad, gst-plugins-ugly, gst-libav, python-gst, python2-gst): Update to 1.12.1. Marius Bakke 2017-05-09gnu: gstreamer: Update to 1.12.0....* gnu/packages/gstreamer.scm (gstreamer, gst-plugins-base, gst-plugins-good, gst-plugins-bad, gst-plugins-ugly, gst-libav, python-gst): Update to 1.12.0. Leo Famulari 2017-04-20gnu: gst-plugins-base: Remove dead comment....This is a followup to 1d8e7273578e95f6b5e4293ac34c4f6fe5d5c579. * gnu/packages/gstreamer.scm (gst-plugins-base): Remove dead comment. Leo Famulari 2017-03-30gnu: orc: Update home page....* gnu/packages/gstreamer.scm (orc)[home-page]: Update. Tobias Geerinckx-Rice