@@ -95,11 +95,12 @@ memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; snprintf(portCString, 7, "%" PRIu16, port); - if (getaddrinfo([host cString], portCString, &hints, &res0)) + if (getaddrinfo([host cStringWithEncoding: OF_STRING_ENCODING_NATIVE], + portCString, &hints, &res0)) @throw [OFAddressTranslationFailedException newWithClass: isa socket: self host: host]; for (res = res0; res != NULL; res = res->ai_next) { @@ -127,11 +128,12 @@ addrlist = [[OFDataArray alloc] initWithItemSize: sizeof(char**)]; [mutex lock]; # endif - if ((he = gethostbyname([host cString])) == NULL) { + if ((he = gethostbyname([host cStringWithEncoding: + OF_STRING_ENCODING_NATIVE])) == NULL) { # ifdef OF_THREADS [addrlist release]; [mutex unlock]; # endif @throw [OFAddressTranslationFailedException newWithClass: isa @@ -220,11 +222,12 @@ memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; snprintf(portCString, 7, "%" PRIu16, port); - if (getaddrinfo([host cString], portCString, &hints, &res)) + if (getaddrinfo([host cStringWithEncoding: OF_STRING_ENCODING_NATIVE], + portCString, &hints, &res)) @throw [OFAddressTranslationFailedException newWithClass: isa socket: self host: host]; if ((sock = socket(res->ai_family, SOCK_STREAM, 0)) == INVALID_SOCKET) @@ -249,11 +252,12 @@ # ifdef OF_THREADS [mutex lock]; # endif - if ((he = gethostbyname([host cString])) == NULL) { + if ((he = gethostbyname([host cStringWithEncoding: + OF_STRING_ENCODING_NATIVE])) == NULL) { # ifdef OF_THREADS [mutex unlock]; # endif @throw [OFAddressTranslationFailedException newWithClass: isa socket: self @@ -403,11 +407,12 @@ if (getnameinfo((struct sockaddr*)sockAddr, sockAddrLen, host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST)) @throw [OFAddressTranslationFailedException newWithClass: isa]; - return [OFString stringWithCString: host]; + return [OFString stringWithCString: host + encoding: OF_STRING_ENCODING_NATIVE]; } @finally { [self freeMemory: host]; } #else # ifdef OF_THREADS @@ -419,11 +424,12 @@ if (host == NULL) @throw [OFAddressTranslationFailedException newWithClass: isa]; - return [OFString stringWithCString: host]; + return [OFString stringWithCString: host + encoding: OF_STRING_ENCODING_NATIVE]; # ifdef OF_THREADS } @finally { [mutex unlock]; } # endif