Icon

kn_forum_36135_special_characters

Special Characters with KNIME under Windows and MacOSX

Special Characters with KNIME under Windows and MacOSX
- the workflow is there to check at several points if the special charaters are stil there (especially for Windows 10)

Annotations and comments
  • library(readODS) file_location <- knime.flow.in[["v_export_ods_file"]] # Read the ODS file as a tibble ods_data <- read_ods(path = file_location, sheet = "Sayfa1", col_names = FALSE, col_types = NULL, na = "", skip = 0, formula_as_formula = FALSE, range = NULL) # Convert the tibble to a data.frame knime.out <- as.data.frame(ods_data)
  • Initial data from example (forum) %%00009test_s.xlsx %%00009data.txt %%00009test_s.csv অটোমোবাইল এবং স্বয়ংক্রিয় যন্ত্রাংশ%%00009ऑटोमोबाइल और ऑटो पार्ट्स%%00009자동차 및 자동차 부품%%00009Gépkocsik és autóalkatrészek%%00009Bílar og sjálfvirkar hlutar অটোমোবাইল%%00009ऑटोमोबाइल%%00009자동차%%00009Gépkocsik%%00009Bílar অটো%%00009ऑटो%%00009자동으로%%00009Autó%%00009Sjálfkrafa স্বয়ংক্রিয় যন্ত্রাংশ%%00009ऑटो भाग%%00009자동차 부품%%00009AUTÓ ALKATRÉSZEK%%00009BÍLAVARAHLUTIR অটোমোবাইল অংশ%%00009ऑटोमोबाइल पार्ट्स%%00009자동차 부품%%00009Gépkocsik részei%%00009Bílar hlutar অটোমোবাইল%%00009ऑटोमोबाइल%%00009자동차%%00009Gépkocsik%%00009Bílar
  • source files
  • library(arrow) library(RSQLite) library(foreign) library(readr) file_location <- knime.flow.in[["v_path_csv_file"]] # https://readr.tidyverse.org/reference/read_delim.html # enter the correct delimiter like , comma ; semicolon, | pipe df <- as.data.frame(read_delim(file_location, delim=";", col_names = FALSE)) # ----- location of SQLite Database # define some basic variables var_loc_sqlite <- paste0(knime.flow.in[["var_path_data"]], "db.sqlite") con = dbConnect(drv=RSQLite::SQLite(), dbname=var_loc_sqlite) dbWriteTable(con, "test_file", df, overwrite = TRUE) # export as ARFF file var_loc_arff <- knime.flow.in[["v_path_arff_file"]] write.arff(df, var_loc_arff, eol = "\n") # export file as parquet var_loc_parquet <- knime.flow.in[["v_path_parquet_file"]] write_parquet(df, var_loc_parquet) # bring data back to KNIME knime.out <- df dbDisconnect(con)
  • library(arrow) library(foreign) df <- as.data.frame(read_parquet(knime.flow.in[["v_path_parquet_file"]])) knime.out <- df
  • knime://knime.workflow/data/test_file.arff
  • test_s.csv
  • test_s_utf_16le.csv
  • context.workflow.parent-path
  • path.separator.system length_parent_path= length(column("context.workflow.parent-path")) substr(column("context.workflow.parent-path"), length_parent_path-1, 1)
  • => paths
  • create /data/ folder if it does not exist
  • context.workflow.absolute-path context.workflow.path context.workflow.name
  • context.workflow.data-path
  • data-path
  • path variables
  • default.test_file
  • test_s.xlsx
  • data.txt
  • v_path_parquet_file
  • v_path_arff_file
  • v_export_ods_file /data/test_s.od
  • v_path_csv_file
  • knime://knime.workflow/data/test_file.parquet
  • read Parquet file, again ....
  • read CSV file and export to KNIME, SQLite and ARFF
  • knime://knime.workflow/data/db.sqlite
  • v_path*
  • manual copy
  • data_txt_file_reader_complex.table
  • test_s_csv_file_reader_complex.table

Nodes

Extensions

Links